From 4624e0f4d9235c14df3d25039334c19d8b73653a Mon Sep 17 00:00:00 2001 From: huisman <23581164+huisman@users.noreply.github.com> Date: Sat, 7 Jun 2025 15:58:52 +0200 Subject: [PATCH 1/3] Update python image version and reduce size Update python image to 3.13 Reduce size by adding `--no-install-recommands` and removing `/var/lib/apt/lists/*` --- gallery/Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gallery/Dockerfile b/gallery/Dockerfile index 7a18b7e9a18..f6bf3a3ff60 100644 --- a/gallery/Dockerfile +++ b/gallery/Dockerfile @@ -1,11 +1,12 @@ -FROM python:3.8.2-slim +FROM python:3.13-slim # note: a single RUN to avoid too many image layers being produced RUN apt-get update \ && apt-get upgrade -y \ - && apt-get install git apt-utils -y \ + && apt-get install git apt-utils -y --no-install-recommends\ && git config --global user.email "black@psf.github.com" \ - && git config --global user.name "Gallery/Black" + && git config --global user.name "Gallery/Black" \ + && rm -rf /var/lib/apt/lists/* COPY gallery.py / ENTRYPOINT ["python", "/gallery.py"] From b9cf33eac81f0782bb779ee8a97765748c026386 Mon Sep 17 00:00:00 2001 From: huisman <23581164+huisman@users.noreply.github.com> Date: Sat, 14 Jun 2025 17:03:14 +0200 Subject: [PATCH 2/3] Use python base image without minor version Use python:3-slim instead of python:3.13-slim as base image for the gallery Dockerfile --- gallery/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gallery/Dockerfile b/gallery/Dockerfile index f6bf3a3ff60..ced85e58e6e 100644 --- a/gallery/Dockerfile +++ b/gallery/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.13-slim +FROM python:3-slim # note: a single RUN to avoid too many image layers being produced RUN apt-get update \ From 6990a8aabb8d266421b285f0f79db10d5bfab563 Mon Sep 17 00:00:00 2001 From: huisman <23581164+huisman@users.noreply.github.com> Date: Sat, 14 Jun 2025 17:35:25 +0200 Subject: [PATCH 3/3] Update CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index f5b123e8a70..13b57e76959 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -63,6 +63,7 @@ - Fix the version check in the vim file to reject Python 3.8 (#4567) - Enhance GitHub Action `psf/black` to read Black version from an additional section in pyproject.toml: `[project.dependency-groups]` (#4606) +- Build gallery docker image with python3-slim and reduce image size (#4686) ### Documentation