fix(docker): use clean multi-stage build without inherited GPG_KEY
This commit is contained in:
1 parent
03d9922066
commit
17e2ec47b2
1 file changed
+21
-14
+21
-14
@@ -1,35 +1,42 @@
|
||||
FROM python:3.11-slim
|
||||
# Étape 1 : Construction et installation des dépendances
|
||||
FROM python:3.11-slim AS builder
|
||||
|
||||
# Dépendances système et polices
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
curl \
|
||||
ca-certificates \
|
||||
xz-utils \
|
||||
libfontconfig1 \
|
||||
fonts-dejavu \
|
||||
fonts-freefont-ttf \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Typst 0.15.1 officiel
|
||||
RUN curl -sSL https://github.com/typst/typst/releases/download/v0.15.1/typst-x86_64-unknown-linux-musl.tar.xz | tar -xJ -C /tmp \
|
||||
&& mv /tmp/typst-x86_64-unknown-linux-musl/typst /usr/local/bin/typst \
|
||||
&& chmod +x /usr/local/bin/typst \
|
||||
&& rm -rf /tmp/typst* \
|
||||
&& typst --version
|
||||
&& 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
|
||||
|
||||
# Création de l'utilisateur non-root 1005:1005
|
||||
RUN groupadd -g 1005 gemini2-ops && useradd -u 1005 -g 1005 -m -s /bin/bash gemini2-ops
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Dépendances Python
|
||||
COPY requirements.txt /app/
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Code source applicatif
|
||||
COPY . /app/
|
||||
|
||||
# Préparation des dossiers montés
|
||||
RUN mkdir -p /app/jobs /app/data /app/ref /app/exemples \
|
||||
&& chown -R 1005:1005 /app
|
||||
|
||||
|
||||
Reference in new issue
Block a user