Skip to content

Commit d2d3f71

Browse files
authored
Fix locale for pg16 (#260)
1 parent 4a3b553 commit d2d3f71

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

Diff for: pg16/Dockerfile

+14
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,20 @@ LABEL fly.version=${VERSION}
3939
LABEL fly.pg-version=${PG_VERSION}
4040
LABEL fly.pg-manager=repmgr
4141

42+
# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
43+
RUN set -eux; \
44+
if [ -f /etc/dpkg/dpkg.cfg.d/docker ]; then \
45+
# if this file exists, we're likely in "debian:xxx-slim", and locales are thus being excluded so we need to remove that exclusion (since we need locales)
46+
grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; \
47+
sed -ri '/\/usr\/share\/locale/d' /etc/dpkg/dpkg.cfg.d/docker; \
48+
! grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; \
49+
fi; \
50+
apt-get update; apt-get install -y --no-install-recommends locales; rm -rf /var/lib/apt/lists/*; \
51+
echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen; \
52+
locale-gen; \
53+
locale -a | grep 'en_US.utf8'
54+
ENV LANG en_US.utf8
55+
4256
RUN apt-get update && apt-get install --no-install-recommends -y \
4357
ca-certificates iproute2 curl bash dnsutils vim socat procps ssh gnupg rsync barman-cli barman barman-cli-cloud python3-setuptools cron gosu \
4458
&& apt autoremove -y && apt clean && \

Diff for: pg16/Dockerfile-timescaledb

+14
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,20 @@ LABEL fly.version=${VERSION}
3838
LABEL fly.pg-version=${PG_VERSION}
3939
LABEL fly.pg-manager=repmgr
4040

41+
# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
42+
RUN set -eux; \
43+
if [ -f /etc/dpkg/dpkg.cfg.d/docker ]; then \
44+
# if this file exists, we're likely in "debian:xxx-slim", and locales are thus being excluded so we need to remove that exclusion (since we need locales)
45+
grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; \
46+
sed -ri '/\/usr\/share\/locale/d' /etc/dpkg/dpkg.cfg.d/docker; \
47+
! grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; \
48+
fi; \
49+
apt-get update; apt-get install -y --no-install-recommends locales; rm -rf /var/lib/apt/lists/*; \
50+
echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen; \
51+
locale-gen; \
52+
locale -a | grep 'en_US.utf8'
53+
ENV LANG en_US.utf8
54+
4155
RUN apt-get update && apt-get install --no-install-recommends -y \
4256
ca-certificates iproute2 curl bash dnsutils vim socat procps ssh gnupg rsync barman-cli barman barman-cli-cloud python3-setuptools cron gosu \
4357
&& apt autoremove -y && apt clean && \

0 commit comments

Comments
 (0)