@@ -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
55RUN 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
1220ENV PG_MAJOR %%PG_MAJOR%%
1321ENV 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
1925RUN 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 \
2329postgresql-$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
2633RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
2734
0 commit comments