|
1 | | -FROM postgres:9.4 |
| 1 | +FROM debian:jessie |
| 2 | + |
| 3 | +# explicitly set user/group IDs |
| 4 | +RUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres |
| 5 | + |
| 6 | +# grab gosu for easy step-down from root |
| 7 | +RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 |
| 8 | +RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \ |
| 9 | + && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture)" \ |
| 10 | + && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture).asc" \ |
| 11 | + && gpg --verify /usr/local/bin/gosu.asc \ |
| 12 | + && rm /usr/local/bin/gosu.asc \ |
| 13 | + && chmod +x /usr/local/bin/gosu \ |
| 14 | + && apt-get purge -y --auto-remove ca-certificates wget |
| 15 | + |
| 16 | +# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default |
| 17 | +RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \ |
| 18 | + && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 |
| 19 | +ENV LANG en_US.utf8 |
| 20 | + |
| 21 | +RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8 |
| 22 | + |
| 23 | +ENV PG_MAJOR 9.4 |
| 24 | +ENV PG_VERSION 9.4.6-1.pgdg80+1 |
| 25 | + |
| 26 | +RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list |
| 27 | + |
| 28 | +RUN apt-get update \ |
| 29 | + && apt-get install -y postgresql-common \ |
| 30 | + && sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \ |
| 31 | + && apt-get install -y \ |
| 32 | + postgresql-$PG_MAJOR=$PG_VERSION \ |
| 33 | + postgresql-contrib-$PG_MAJOR=$PG_VERSION \ |
| 34 | + && rm -rf /var/lib/apt/lists/* |
| 35 | + |
| 36 | +RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql |
| 37 | + |
| 38 | +ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH |
| 39 | +ENV PGDATA /var/lib/postgresql/data |
| 40 | + |
| 41 | +# install pip and wal-e dependencies |
| 42 | +RUN apt-get update && apt-get install -y \ |
| 43 | + ca-certificates \ |
| 44 | + curl \ |
| 45 | + gcc \ |
| 46 | + git \ |
| 47 | + lzop \ |
| 48 | + pv \ |
| 49 | + python \ |
| 50 | + python-dev \ |
| 51 | + --no-install-recommends \ |
| 52 | + && rm -rf /var/lib/apt/lists/* |
| 53 | + |
| 54 | +# install pip |
| 55 | +RUN curl -sSL https://raw.githubusercontent.com/pypa/pip/7.1.2/contrib/get-pip.py | python - |
| 56 | + |
| 57 | +# install wal-e |
| 58 | +RUN pip install --disable-pip-version-check --no-cache-dir git+https://github.com/bacongobbler/wal-e.git@boto3-upgrade |
| 59 | + |
| 60 | +# install python port of daemontools |
| 61 | +RUN pip install --disable-pip-version-check --no-cache-dir envdir |
2 | 62 |
|
3 | 63 | COPY . / |
4 | 64 |
|
| 65 | +# create envdir for wal-e config |
| 66 | +ENV WALE_ENVDIR /etc/wal-e.d/env |
| 67 | +RUN mkdir -p $WALE_ENVDIR |
| 68 | + |
| 69 | +ENV BUCKET_NAME dbwal |
| 70 | + |
| 71 | +ENTRYPOINT ["/docker-entrypoint.sh"] |
| 72 | +EXPOSE 5432 |
| 73 | +CMD ["postgres"] |
| 74 | + |
5 | 75 | ENV DEIS_RELEASE 2.0.0-dev |
0 commit comments