From 2ab4f60a0f0b9c5307870de2d48ed8b4ab4f95b7 Mon Sep 17 00:00:00 2001 From: bolbol Date: Tue, 10 Nov 2026 00:22:48 +0000 Subject: [PATCH] feat: clean debian bookworm image and MPLCONFIGDIR for read-only rootfs --- Dockerfile | 29 ++++++++++------------------- figures.py | 1 + 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/Dockerfile b/Dockerfile index d702035..546edd2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,15 @@ -# Étape 1 : Construction et installation des dépendances -FROM python:3.11-slim AS builder +FROM debian:bookworm-slim RUN apt-get update && apt-get install -y --no-install-recommends \ + python3 \ + python3-pip \ + python3-venv \ curl \ ca-certificates \ xz-utils \ + libfontconfig1 \ + fonts-dejavu \ + fonts-freefont-ttf \ && rm -rf /var/lib/apt/lists/* # Typst 0.15.1 officiel @@ -13,23 +18,9 @@ RUN curl -sSL https://github.com/typst/typst/releases/download/v0.15.1/typst-x86 && chmod +x /usr/local/bin/typst \ && rm -rf /tmp/typst* -WORKDIR /build -COPY requirements.txt /build/ -RUN pip install --no-cache-dir -r requirements.txt - -# Étape 2 : Image d'exécution propre sans variables GPG_KEY héritées -FROM debian:bookworm-slim - -ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin -ENV MPLCONFIGDIR=/tmp/matplotlib - -RUN apt-get update && apt-get install -y --no-install-recommends \ - libfontconfig1 \ - fonts-dejavu \ - fonts-freefont-ttf \ - && rm -rf /var/lib/apt/lists/* - -COPY --from=builder /usr/local /usr/local +COPY requirements.txt /tmp/ +RUN pip3 install --break-system-packages --no-cache-dir -r /tmp/requirements.txt \ + && rm -f /tmp/requirements.txt RUN groupadd -g 1005 gemini2-ops && useradd -u 1005 -g 1005 -m -s /bin/bash gemini2-ops diff --git a/figures.py b/figures.py index d73f023..1ec7d1b 100644 --- a/figures.py +++ b/figures.py @@ -7,6 +7,7 @@ ou résolution d'images existantes. """ import os +os.environ.setdefault("MPLCONFIGDIR", "/tmp/matplotlib") import shutil import numpy as np import matplotlib