clean up docker and makefile

* remove gosuuser - this means we can upgrade the base image to
  something more modern and not have to faff around with gpg
* remove unnecessary commands - some things need to exist in the
  makefile to keep jenkins happy
* remove concept of building separately - pip install requirements.txt
  in the dockerfile
This commit is contained in:
Leo Hemsted
2019-10-11 11:58:35 +01:00
parent 0152dcf254
commit 9e64dcbb2f
7 changed files with 23 additions and 150 deletions

View File

@@ -1,12 +1,11 @@
FROM python:3.5-slim-jessie
FROM python:3.6-slim
ARG HTTP_PROXY
ARG HTTPS_PROXY
ARG NO_PROXY
ENV PYTHONUNBUFFERED=1 \
DEBIAN_FRONTEND=noninteractive \
GOSU_VERSION=1.10
DEBIAN_FRONTEND=noninteractive
RUN \
echo "Install base packages" \
@@ -19,39 +18,22 @@ RUN \
build-essential \
zip \
libpq-dev \
libffi-dev \
python-dev \
jq \
&& echo "Clean up" \
&& rm -rf /var/lib/apt/lists/* /tmp/*
RUN \
echo "Install global pip packages" \
&& pip install \
virtualenv \
awscli \
wheel
RUN \
echo "Install Cloud Foundry CLI" \
&& curl -sSL "https://cli.run.pivotal.io/stable?release=debian64&source=github" -o /tmp/cloudfoundry-cli.deb \
&& dpkg -i /tmp/cloudfoundry-cli.deb
COPY tianon.gpg /tmp/tianon.gpg
# these are declared statically here so that they're cached by the docker image - if we run after the `COPY` command
# they won't be cached so it'll re-download every time. But these don't involve the filesystem
COPY requirements.txt .
COPY requirements_for_test.txt .
RUN \
echo "Install gosu" \
&& curl -sSL -o /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
&& curl -sSL -o /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --import /tmp/tianon.gpg \
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
&& rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& gosu nobody true
echo "Installing python dependencies" \
&& pip install -r requirements_for_test.txt
WORKDIR /var/project
COPY entrypoint.sh /usr/local/bin/docker-entrypoint
ENTRYPOINT ["/usr/local/bin/docker-entrypoint"]
COPY . .