Skip to content

Commit be1413f

Browse files
committed
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 postmanlabs#493.
1 parent 7b3b70d commit be1413f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Dockerfile

+9-3
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@ LABEL version="0.9.2"
55
LABEL description="A simple HTTP service."
66
LABEL org.kennethreitz.vendor="Kenneth Reitz"
77

8-
RUN apt update -y && apt install python3-pip -y
8+
ENV LC_ALL=C.UTF-8
9+
ENV LANG=C.UTF-8
910

10-
EXPOSE 80
11+
RUN apt update -y && apt install python3-pip git -y && pip3 install --no-cache-dir pipenv
12+
13+
ADD Pipfile Pipfile.lock /httpbin/
14+
WORKDIR /httpbin
15+
RUN /bin/bash -c "pip3 install --no-cache-dir -r <(pipenv lock -r)"
1116

1217
ADD . /httpbin
18+
RUN pip3 install --no-cache-dir /httpbin
1319

14-
RUN pip3 install --no-cache-dir gunicorn /httpbin
20+
EXPOSE 80
1521

1622
CMD ["gunicorn", "-b", "0.0.0.0:80", "httpbin:app", "-k", "gevent"]

0 commit comments

Comments
 (0)