From 103b5f5c83c63cf774e7672aa6a44107e92ae762 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Sat, 21 Mar 2026 13:31:49 +0100 Subject: [PATCH] Reduce Docker image size (#337) * Initial plan * reduce docker image size: clean caches, remove apt upgrade, use --no-install-recommends Co-authored-by: ThePhaseless <33990351+ThePhaseless@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ThePhaseless <33990351+ThePhaseless@users.noreply.github.com> --- Dockerfile | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 99f6277..f4db43b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,6 @@ FROM ubuntu:latest AS base ARG GITHUB_BUILD=false \ - UV_CACHE_DIR=/var/cache/uv \ VERSION ENV GITHUB_BUILD=${GITHUB_BUILD}\ @@ -12,20 +11,23 @@ ENV GITHUB_BUILD=${GITHUB_BUILD}\ # prevents python creating .pyc files PYTHONDONTWRITEBYTECODE=1 \ UV_LINK_MODE=copy \ - UV_CACHE_DIR=${UV_CACHE_DIR} \ PORT=8191 \ XDG_CACHE_HOME=/cache \ HOME=/tmp -RUN apt update &&\ - apt -y upgrade &&\ - apt install -y curl +RUN apt-get update &&\ + apt-get install -y --no-install-recommends curl ca-certificates &&\ + apt-get clean &&\ + rm -rf /var/lib/apt/lists/* COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ FROM base AS devcontainer -RUN apt install -y git &&\ +RUN apt-get update &&\ + apt-get install -y --no-install-recommends git &&\ uvx playwright install-deps firefox &&\ - uvx camoufox fetch + uvx camoufox fetch &&\ + apt-get clean &&\ + rm -rf /var/lib/apt/lists/* ENTRYPOINT [ "sleep", "infinity" ] FROM base AS app @@ -35,7 +37,11 @@ COPY pyproject.toml uv.lock ./ RUN mkdir -p /cache &&\ uv sync &&\ uv run camoufox fetch &&\ - uv run playwright install-deps firefox + apt-get update &&\ + uv run playwright install-deps firefox &&\ + uv cache clean &&\ + apt-get clean &&\ + rm -rf /var/lib/apt/lists/* COPY . .