From be1413fb022a3921d4a9b1a63e588199e2106f39 Mon Sep 17 00:00:00 2001 From: Brett Randall Date: Fri, 27 Jul 2018 14:41:58 +1000 Subject: [PATCH] Changed Dockerfile to resolve deps using pipenv/Pipefile(.lock) before pip3->setup.py for httpbin. Also added Pipfile(.lock) prior to the remaining source, improving Docker image cacheability. Git is also required to fetch pyyaml. This results in more deterministic and reproducible image builds, since httpbin dependencies are installed using locked versions from Pipfile.lock before httpbin is itself installed. Fixed #493. --- Dockerfile | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6e391a6..819006b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,12 +5,18 @@ LABEL version="0.9.2" LABEL description="A simple HTTP service." LABEL org.kennethreitz.vendor="Kenneth Reitz" -RUN apt update -y && apt install python3-pip -y +ENV LC_ALL=C.UTF-8 +ENV LANG=C.UTF-8 + +RUN apt update -y && apt install python3-pip git -y && pip3 install --no-cache-dir pipenv + +ADD Pipfile Pipfile.lock /httpbin/ +WORKDIR /httpbin +RUN /bin/bash -c "pip3 install --no-cache-dir -r <(pipenv lock -r)" + +ADD . /httpbin +RUN pip3 install --no-cache-dir /httpbin EXPOSE 80 -ADD . /httpbin - -RUN pip3 install --no-cache-dir gunicorn /httpbin - CMD ["gunicorn", "-b", "0.0.0.0:80", "httpbin:app", "-k", "gevent"]