Skip to content

Commit f502600

Browse files
committed
Merge pull request #103 from krancour/image-madness
chore(Dockerfile): Refactor image to use ubuntu-slim
2 parents 7900e51 + 067d4ae commit f502600

1 file changed

Lines changed: 51 additions & 64 deletions

File tree

rootfs/Dockerfile

Lines changed: 51 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,63 @@
1-
FROM debian:jessie
1+
FROM quay.io/deis/base:0.2.0
22

3-
# explicitly set user/group IDs
4-
RUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres
3+
ENV LANG=en_US.utf8 \
4+
PG_MAJOR=9.4 \
5+
PG_VERSION=9.4.8-1.pgdg80+1 \
6+
PGDATA=/var/lib/postgresql/data \
7+
WALE_ENVDIR=/etc/wal-e.d/env
58

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
9+
# Set this separately from those above since it depends on one of them
10+
ENV PATH=/usr/lib/postgresql/$PG_MAJOR/bin:$PATH
2211

23-
ENV PG_MAJOR 9.4
24-
ENV PG_VERSION 9.4.8-1.pgdg80+1
12+
# Add postgres user and group
13+
RUN adduser --system \
14+
--shell /bin/bash \
15+
--disabled-password \
16+
--group \
17+
postgres
2518

26-
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
19+
COPY . /
2720

28-
RUN apt-get update \
21+
RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
22+
&& curl -L -o /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture)" \
23+
&& curl -L -o /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture).asc" \
24+
&& gpg --verify /usr/local/bin/gosu.asc \
25+
&& rm /usr/local/bin/gosu.asc \
26+
&& chmod +x /usr/local/bin/gosu \
27+
&& localedef -i en_US -c -f UTF-8 -A /etc/locale.alias en_US.UTF-8 \
28+
&& apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8 \
29+
&& echo 'deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list \
30+
&& apt-get update \
2931
&& apt-get install -y postgresql-common \
3032
&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
3133
&& apt-get install -y \
34+
gcc \
35+
git \
36+
libssl-dev \
37+
libffi-dev \
38+
lzop \
3239
postgresql-$PG_MAJOR=$PG_VERSION \
3340
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-
libssl-dev \
52-
libffi-dev \
53-
--no-install-recommends \
54-
&& rm -rf /var/lib/apt/lists/*
55-
56-
# install pip
57-
RUN curl -sSL https://raw.githubusercontent.com/pypa/pip/7.1.2/contrib/get-pip.py | python -
58-
59-
# install deis/wal-e from the tip of the boto3-upgrade branch
60-
# NOTE (bacongobbler): we use the commit here so Docker's cache will bust when we make changes upstream
61-
RUN pip install --disable-pip-version-check --no-cache-dir git+https://github.com/deis/wal-e.git@0eee12665149d8389cda9575b737359d066fa663
62-
63-
# install python port of daemontools
64-
RUN pip install --disable-pip-version-check --no-cache-dir envdir
65-
66-
COPY . /
67-
68-
# create envdir for wal-e config
69-
ENV WALE_ENVDIR /etc/wal-e.d/env
70-
RUN mkdir -p $WALE_ENVDIR
71-
72-
ENTRYPOINT ["/docker-entrypoint.sh"]
41+
pv \
42+
python \
43+
python-dev \
44+
--no-install-recommends \
45+
&& mkdir -p /var/run/postgresql \
46+
&& chown -R postgres /var/run/postgresql \
47+
&& curl -sSL https://raw.githubusercontent.com/pypa/pip/7.1.2/contrib/get-pip.py | python - \
48+
&& pip install --disable-pip-version-check --no-cache-dir git+https://github.com/deis/wal-e.git@0eee12665149d8389cda9575b737359d066fa663 \
49+
&& mkdir -p $WALE_ENVDIR \
50+
&& pip install --disable-pip-version-check --no-cache-dir envdir \
51+
&& apt-get remove -y --auto-remove --purge \
52+
gcc \
53+
git \
54+
libssl-dev \
55+
libffi-dev \
56+
python-dev \
57+
&& apt-get clean \
58+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man /usr/share/doc
59+
60+
CMD ["/docker-entrypoint.sh", "postgres"]
7361
EXPOSE 5432
74-
CMD ["postgres"]
7562

76-
ENV WORKFLOW_RELEASE 2.0.0-dev
63+
ENV WORKFLOW_RELEASE 2.0.0

0 commit comments

Comments
 (0)