Skip to content
This repository was archived by the owner on Sep 6, 2024. It is now read-only.

Commit d74b695

Browse files
committed
Add proper UTF-8 locale (thus enabling UTF-8 defaults) and update a few minor idioms that take the image from ~244.1 MB down to ~213.6 MB
1 parent 65602d6 commit d74b695

File tree

7 files changed

+98
-49
lines changed

7 files changed

+98
-49
lines changed

8.4/Dockerfile

+14-7
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,31 @@ FROM debian:wheezy
44
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
55
RUN groupadd -r postgres && useradd -r -g postgres postgres
66

7-
RUN apt-get update && apt-get install -y curl
7+
# grab gosu for easy step-down from root
8+
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* \
9+
&& curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \
10+
&& chmod +x /usr/local/bin/gosu \
11+
&& apt-get purge -y --auto-remove curl
812

9-
RUN curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \
10-
&& chmod +x /usr/local/bin/gosu
13+
# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
14+
RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
15+
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
16+
ENV LANG en_US.utf8
17+
18+
RUN apt-key adv --keyserver pgp.mit.edu --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
1119

1220
ENV PG_MAJOR 8.4
1321
ENV PG_VERSION 8.4.22-1.pgdg70+1
1422

15-
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list \
16-
&& curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc \
17-
| apt-key add - ED6D65271AACF0FF15D123036FB2A1C265FFB764
23+
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
1824

1925
RUN apt-get update \
2026
&& apt-get install -y postgresql-common \
2127
&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
2228
&& apt-get install -y \
2329
postgresql-$PG_MAJOR=$PG_VERSION \
24-
postgresql-contrib-$PG_MAJOR=$PG_VERSION
30+
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
31+
&& rm -rf /var/lib/apt/lists/*
2532

2633
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
2734

9.0/Dockerfile

+14-7
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,31 @@ FROM debian:wheezy
44
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
55
RUN groupadd -r postgres && useradd -r -g postgres postgres
66

7-
RUN apt-get update && apt-get install -y curl
7+
# grab gosu for easy step-down from root
8+
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* \
9+
&& curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \
10+
&& chmod +x /usr/local/bin/gosu \
11+
&& apt-get purge -y --auto-remove curl
812

9-
RUN curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \
10-
&& chmod +x /usr/local/bin/gosu
13+
# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
14+
RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
15+
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
16+
ENV LANG en_US.utf8
17+
18+
RUN apt-key adv --keyserver pgp.mit.edu --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
1119

1220
ENV PG_MAJOR 9.0
1321
ENV PG_VERSION 9.0.18-1.pgdg70+1
1422

15-
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list \
16-
&& curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc \
17-
| apt-key add - ED6D65271AACF0FF15D123036FB2A1C265FFB764
23+
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
1824

1925
RUN apt-get update \
2026
&& apt-get install -y postgresql-common \
2127
&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
2228
&& apt-get install -y \
2329
postgresql-$PG_MAJOR=$PG_VERSION \
24-
postgresql-contrib-$PG_MAJOR=$PG_VERSION
30+
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
31+
&& rm -rf /var/lib/apt/lists/*
2532

2633
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
2734

9.1/Dockerfile

+14-7
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,31 @@ FROM debian:wheezy
44
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
55
RUN groupadd -r postgres && useradd -r -g postgres postgres
66

7-
RUN apt-get update && apt-get install -y curl
7+
# grab gosu for easy step-down from root
8+
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* \
9+
&& curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \
10+
&& chmod +x /usr/local/bin/gosu \
11+
&& apt-get purge -y --auto-remove curl
812

9-
RUN curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \
10-
&& chmod +x /usr/local/bin/gosu
13+
# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
14+
RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
15+
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
16+
ENV LANG en_US.utf8
17+
18+
RUN apt-key adv --keyserver pgp.mit.edu --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
1119

1220
ENV PG_MAJOR 9.1
1321
ENV PG_VERSION 9.1.14-1.pgdg70+1
1422

15-
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list \
16-
&& curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc \
17-
| apt-key add - ED6D65271AACF0FF15D123036FB2A1C265FFB764
23+
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
1824

1925
RUN apt-get update \
2026
&& apt-get install -y postgresql-common \
2127
&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
2228
&& apt-get install -y \
2329
postgresql-$PG_MAJOR=$PG_VERSION \
24-
postgresql-contrib-$PG_MAJOR=$PG_VERSION
30+
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
31+
&& rm -rf /var/lib/apt/lists/*
2532

2633
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
2734

9.2/Dockerfile

+14-7
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,31 @@ FROM debian:wheezy
44
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
55
RUN groupadd -r postgres && useradd -r -g postgres postgres
66

7-
RUN apt-get update && apt-get install -y curl
7+
# grab gosu for easy step-down from root
8+
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* \
9+
&& curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \
10+
&& chmod +x /usr/local/bin/gosu \
11+
&& apt-get purge -y --auto-remove curl
812

9-
RUN curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \
10-
&& chmod +x /usr/local/bin/gosu
13+
# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
14+
RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
15+
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
16+
ENV LANG en_US.utf8
17+
18+
RUN apt-key adv --keyserver pgp.mit.edu --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
1119

1220
ENV PG_MAJOR 9.2
1321
ENV PG_VERSION 9.2.9-1.pgdg70+1
1422

15-
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list \
16-
&& curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc \
17-
| apt-key add - ED6D65271AACF0FF15D123036FB2A1C265FFB764
23+
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
1824

1925
RUN apt-get update \
2026
&& apt-get install -y postgresql-common \
2127
&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
2228
&& apt-get install -y \
2329
postgresql-$PG_MAJOR=$PG_VERSION \
24-
postgresql-contrib-$PG_MAJOR=$PG_VERSION
30+
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
31+
&& rm -rf /var/lib/apt/lists/*
2532

2633
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
2734

9.3/Dockerfile

+14-7
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,31 @@ FROM debian:wheezy
44
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
55
RUN groupadd -r postgres && useradd -r -g postgres postgres
66

7-
RUN apt-get update && apt-get install -y curl
7+
# grab gosu for easy step-down from root
8+
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* \
9+
&& curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \
10+
&& chmod +x /usr/local/bin/gosu \
11+
&& apt-get purge -y --auto-remove curl
812

9-
RUN curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \
10-
&& chmod +x /usr/local/bin/gosu
13+
# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
14+
RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
15+
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
16+
ENV LANG en_US.utf8
17+
18+
RUN apt-key adv --keyserver pgp.mit.edu --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
1119

1220
ENV PG_MAJOR 9.3
1321
ENV PG_VERSION 9.3.5-1.pgdg70+1
1422

15-
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list \
16-
&& curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc \
17-
| apt-key add - ED6D65271AACF0FF15D123036FB2A1C265FFB764
23+
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
1824

1925
RUN apt-get update \
2026
&& apt-get install -y postgresql-common \
2127
&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
2228
&& apt-get install -y \
2329
postgresql-$PG_MAJOR=$PG_VERSION \
24-
postgresql-contrib-$PG_MAJOR=$PG_VERSION
30+
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
31+
&& rm -rf /var/lib/apt/lists/*
2532

2633
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
2734

9.4/Dockerfile

+14-7
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,31 @@ FROM debian:wheezy
44
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
55
RUN groupadd -r postgres && useradd -r -g postgres postgres
66

7-
RUN apt-get update && apt-get install -y curl
7+
# grab gosu for easy step-down from root
8+
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* \
9+
&& curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \
10+
&& chmod +x /usr/local/bin/gosu \
11+
&& apt-get purge -y --auto-remove curl
812

9-
RUN curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \
10-
&& chmod +x /usr/local/bin/gosu
13+
# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
14+
RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
15+
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
16+
ENV LANG en_US.utf8
17+
18+
RUN apt-key adv --keyserver pgp.mit.edu --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
1119

1220
ENV PG_MAJOR 9.4
1321
ENV PG_VERSION 9.4~beta2-1.pgdg70+1
1422

15-
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list \
16-
&& curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc \
17-
| apt-key add - ED6D65271AACF0FF15D123036FB2A1C265FFB764
23+
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
1824

1925
RUN apt-get update \
2026
&& apt-get install -y postgresql-common \
2127
&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
2228
&& apt-get install -y \
2329
postgresql-$PG_MAJOR=$PG_VERSION \
24-
postgresql-contrib-$PG_MAJOR=$PG_VERSION
30+
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
31+
&& rm -rf /var/lib/apt/lists/*
2532

2633
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
2734

Dockerfile.template

+14-7
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,31 @@ FROM debian:wheezy
44
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
55
RUN groupadd -r postgres && useradd -r -g postgres postgres
66

7-
RUN apt-get update && apt-get install -y curl
7+
# grab gosu for easy step-down from root
8+
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* \
9+
&& curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \
10+
&& chmod +x /usr/local/bin/gosu \
11+
&& apt-get purge -y --auto-remove curl
812

9-
RUN curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \
10-
&& chmod +x /usr/local/bin/gosu
13+
# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
14+
RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
15+
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
16+
ENV LANG en_US.utf8
17+
18+
RUN apt-key adv --keyserver pgp.mit.edu --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
1119

1220
ENV PG_MAJOR %%PG_MAJOR%%
1321
ENV PG_VERSION %%PG_VERSION%%
1422

15-
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list \
16-
&& curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc \
17-
| apt-key add - ED6D65271AACF0FF15D123036FB2A1C265FFB764
23+
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
1824

1925
RUN apt-get update \
2026
&& apt-get install -y postgresql-common \
2127
&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
2228
&& apt-get install -y \
2329
postgresql-$PG_MAJOR=$PG_VERSION \
24-
postgresql-contrib-$PG_MAJOR=$PG_VERSION
30+
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
31+
&& rm -rf /var/lib/apt/lists/*
2532

2633
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
2734

0 commit comments

Comments
 (0)