Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Commit

Permalink
More Docker improvements (#320)
Browse files Browse the repository at this point in the history
* Docker: install runtime dependencies first

* For better layer caching

* Docker: libpcre3 is already installed

* Docker: use --upgrade and --force-reinstall with pip install

* Docker: copy build files in one go

* Docker: add requirements-dev.txt to dockerignore
  • Loading branch information
JayH5 authored and brndnmtthws committed Sep 23, 2016
1 parent 1713471 commit d6f2aed
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.git
build.bash
tests
requirements-dev.txt
hooks
scripts
.*
Expand Down
37 changes: 21 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
FROM debian:stretch

COPY requirements.txt /marathon-lb/requirements.txt
COPY build-haproxy.sh /marathon-lb/build-haproxy.sh
# runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
iptables \
openssl \
procps \
python3 \
runit \
socat \
&& rm -rf /var/lib/apt/lists/*

COPY requirements.txt build-haproxy.sh \
/marathon-lb/

RUN set -x \
&& buildDeps=" \
&& buildDeps=' \
gcc \
libc6-dev \
libffi-dev \
Expand All @@ -14,22 +24,17 @@ RUN set -x \
make \
python3-dev \
python3-pip \
wget \
" \
&& runDeps=" \
iptables \
libpcre3 \
openssl \
procps \
python3 \
python3-setuptools \
runit \
socat \
" \
wget \
' \
&& apt-get update \
&& apt-get install -y --no-install-recommends $buildDeps $runDeps \
&& apt-get install -y --no-install-recommends $buildDeps \
&& rm -rf /var/lib/apt/lists/* \
&& pip3 install --no-cache -r /marathon-lb/requirements.txt \
# Install Python packages with --upgrade so we get new packages even if a system
# package is already installed. Combine with --force-reinstall to ensure we get
# a local package even if the system package is up-to-date as the system package
# will probably be uninstalled with the build dependencies.
&& pip3 install --no-cache --upgrade --force-reinstall -r /marathon-lb/requirements.txt \
&& /marathon-lb/build-haproxy.sh \
&& apt-get purge -y --auto-remove $buildDeps

Expand Down

0 comments on commit d6f2aed

Please sign in to comment.