Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce docker image size from 534MB to 287MB. #637

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:18.04
FROM python:3.6-alpine

LABEL name="httpbin"
LABEL version="0.9.2"
Expand All @@ -8,14 +8,15 @@ LABEL org.kennethreitz.vendor="Kenneth Reitz"
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/
ADD . /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
RUN apk add --no-cache git gcc musl-dev libffi-dev libstdc++ \
&& pip3 install --no-cache-dir pipenv \
&& pipenv lock -r > req.txt \
&& ln -s /usr/lib/libstdc++.so.6 /usr/lib/libstdc++.so \
&& pip3 install --no-cache-dir --upgrade pip setuptools==45.2.0 \
&& pip3 install --no-cache-dir -r req.txt \
&& pip3 install --no-cache-dir /httpbin

EXPOSE 80

Expand Down