Skip to content

Commit 55a4ba3

Browse files
committed
fix(docker): Setup system locales in containers where it actually counts, not before
1 parent 9bffe4b commit 55a4ba3

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

Dockerfile

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,11 @@ FROM docker.io/library/archlinux:base-devel$ARCHTAG AS builder
77
ARG RUNTIME_DEPS
88
ARG BUILD_DEPS
99

10-
# Enable system locales for everything we have localizations for so tools like
11-
# `date` will output matching localized strings. By default Arch Docker images
12-
# have almost all locale data stripped out. This also makes it easier to
13-
# rebuild custom Docker images with extra languages supported.
14-
RUN sed -i -e '/^NoExtract.*locale/d' /etc/pacman.conf
15-
1610
# Freshen all base system packages
1711
RUN pacman-key --init
1812
RUN pacman --needed --noconfirm -Syq archlinux-keyring
1913
RUN pacman --needed --noconfirm -Suq
2014

21-
# Make sure *at least* glibc actually got reinstalled after enabling
22-
# extraaction of locale files even if the version was fresh so we can use the
23-
# locale support out of it later.
24-
RUN pacman --noconfirm -Sq glibc && yes | pacman -Sccq
25-
2615
# Install run-time dependencies
2716
RUN pacman --needed --noconfirm -Sq $RUNTIME_DEPS $BUILD_DEPS
2817

@@ -32,10 +21,6 @@ ARG REVISION
3221
COPY ./ /src
3322
WORKDIR /src
3423

35-
# Rebuild locale database after having added our supported locales.
36-
RUN ls i18n/ | sed 's/[.-].*$/_/;s/^/^/' | sort -u | grep -Ef - /usr/share/i18n/SUPPORTED > /etc/locale.gen
37-
RUN locale-gen
38-
3924
# GitHub Actions builder stopped providing git history :(
4025
# See feature request at https://github.com/actions/runner/issues/767
4126
RUN build-aux/docker-bootstrap.sh
@@ -58,6 +43,12 @@ ARG REVISION
5843
# Allow `su` with no root password so non-priv users can install dependencies
5944
RUN sed -i -e '/.so$/s/$/ nullok/' /etc/pam.d/su
6045

46+
# Enable system locales for everything we have localizations for so tools like
47+
# `date` will output matching localized strings. By default Arch Docker images
48+
# have almost all locale data stripped out. This also makes it easier to
49+
# rebuild custom Docker images with extra languages supported.
50+
RUN sed -i -e '/^NoExtract.*locale/d' /etc/pacman.conf
51+
6152
# Set system locale to something other than 'C' that resolves to a real language
6253
ENV LANG=en_US.UTF-8
6354

@@ -66,6 +57,11 @@ RUN pacman-key --init
6657
RUN pacman --needed --noconfirm -Syq archlinux-keyring && yes | pacman -Sccq
6758
RUN pacman --needed --noconfirm -Suq && yes | pacman -Sccq
6859

60+
# Make sure *at least* glibc actually got reinstalled after enabling
61+
# extraction of locale files even if the version was fresh so we can use the
62+
# locale support out of it later.
63+
RUN pacman --noconfirm -Sq glibc && yes | pacman -Sccq
64+
6965
# Install run-time dependencies
7066
RUN pacman --needed --noconfirm -Sq $RUNTIME_DEPS && yes | pacman -Sccq
7167

@@ -82,6 +78,11 @@ COPY build-aux/docker-fontconfig.conf /etc/fonts/conf.d/99-docker.conf
8278

8379
COPY --from=builder /pkgdir /
8480
COPY --from=builder /src/src/sile-entry.sh /usr/local/bin
81+
82+
# Rebuild locale database after having added our supported locales.
83+
RUN ls /usr/local/share/sile/i18n/ | sed 's/[.-].*$/_/;s/^/^/' | sort -u | grep -Ef - /usr/share/i18n/SUPPORTED > /etc/locale.gen
84+
RUN locale-gen
85+
8586
RUN sile --version
8687

8788
WORKDIR /data

0 commit comments

Comments
 (0)