From 3b5e2ccf9c8bc1666568b4fad019079ab5647761 Mon Sep 17 00:00:00 2001 From: Abhinav Singh Date: Fri, 11 Oct 2019 11:03:51 -0700 Subject: [PATCH] Reduce docker image size --- Dockerfile | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 291ae291..c0378f21 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,20 @@ -FROM python:3-alpine +FROM python:3.7-alpine as base +FROM base as builder + +COPY requirements.txt . +RUN pip install --upgrade pip && pip install --install-option="--prefix=/deps" -r requirements.txt + +FROM base + LABEL com.abhinavsingh.name="abhinavsingh/proxy.py" \ com.abhinavsingh.description="⚡⚡⚡ Fast, Lightweight, Programmable Proxy Server in a single Python file" \ com.abhinavsingh.url="https://github.com/abhinavsingh/proxy.py" \ com.abhinavsingh.vcs-url="https://github.com/abhinavsingh/proxy.py" \ com.abhinavsingh.docker.cmd="docker run -it --rm -p 8899:8899 abhinavsingh/proxy.py" +COPY --from=builder /deps /usr/local +COPY proxy.py /app/ WORKDIR /app -COPY requirements.txt . -COPY proxy.py . - -RUN pip install --upgrade pip && pip install -r requirements.txt - EXPOSE 8899/tcp ENTRYPOINT [ "./proxy.py" ] CMD [ "--hostname=0.0.0.0", \