Skip to content

Commit ccaf631

Browse files
committed
ref(image): handle Dockerfile build deps via variables
Also speed up apt-get update by disabling source repos
1 parent b6195a3 commit ccaf631

1 file changed

Lines changed: 14 additions & 22 deletions

File tree

rootfs/Dockerfile

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,20 @@ RUN adduser --system \
99

1010
COPY . /app
1111

12-
RUN apt-get update \
13-
&& apt-get install -y \
14-
gcc \
15-
git \
16-
libffi-dev \
17-
libpq5 \
18-
libpq-dev \
19-
python3 \
20-
python3-dev \
21-
sudo \
22-
&& ln -s /usr/bin/python3 /usr/bin/python \
23-
&& curl -sSL https://bootstrap.pypa.io/get-pip.py | python - pip==8.1.2 \
24-
&& mkdir -p /configs && chown -R deis:deis /configs \
25-
&& pip install --disable-pip-version-check --no-cache-dir -r /app/requirements.txt \
26-
&& apt-get remove -y --auto-remove --purge \
27-
gcc \
28-
git \
29-
libffi-dev \
30-
libpq-dev \
31-
python3-dev \
32-
&& apt-get clean \
33-
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man /usr/share/doc
12+
RUN buildDeps='gcc git libffi-dev libpq-dev python3-dev'; \
13+
apt-get update && \
14+
apt-get install -y --no-install-recommends \
15+
$buildDeps \
16+
libpq5 \
17+
python3 \
18+
sudo && \
19+
ln -s /usr/bin/python3 /usr/bin/python && \
20+
curl -sSL https://bootstrap.pypa.io/get-pip.py | python - pip==8.1.2 && \
21+
mkdir -p /configs && chown -R deis:deis /configs && \
22+
pip install --disable-pip-version-check --no-cache-dir -r /app/requirements.txt && \
23+
apt-get purge -y --auto-remove $buildDeps && \
24+
apt-get clean && \
25+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man /usr/share/doc
3426

3527
# define execution environment
3628
WORKDIR /app

0 commit comments

Comments
 (0)