From f19db0ce1be5b53b16439a187227e1f10d893f76 Mon Sep 17 00:00:00 2001 From: Abhinav Singh Date: Wed, 15 May 2024 20:24:41 +0530 Subject: [PATCH] Optimize base docker image size --- DockerfileBase | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/DockerfileBase b/DockerfileBase index c5c42f8b42..99c1ef67ab 100644 --- a/DockerfileBase +++ b/DockerfileBase @@ -14,6 +14,7 @@ LABEL com.abhinavsingh.name="abhinavsingh/proxy.py" \ org.opencontainers.image.vendor="Abhinav Singh" ENV PYTHONUNBUFFERED 1 +ENV PYTHONDONTWRITEBYTECODE 1 # Install paramiko and cryptography to allow # users to use tunneling features using Docker @@ -28,10 +29,13 @@ RUN apk update && apk --no-cache add \ rust \ make RUN python -m venv /proxy/venv && \ - /proxy/venv/bin/pip install --no-cache-dir \ + /proxy/venv/bin/pip install --no-compile --no-cache-dir \ -U pip wheel && \ - /proxy/venv/bin/pip install --no-cache-dir \ + /proxy/venv/bin/pip install --no-compile --no-cache-dir \ paramiko==3.4.0 \ cryptography==39.0.1 \ - --prefer-binary -RUN apk del .builddeps + --prefer-binary && \ + apk del .builddeps && \ + find . -type d -name '__pycache__' | xargs rm -rf && \ + rm -rf /var/cache/apk/* && \ + rm -rf /root/.cache/