|
|
@@ -1,32 +1,33 @@
|
|
|
-# Image de base Python
|
|
|
-FROM python:3.13-slim
|
|
|
+# ---------- BUILD STAGE ----------
|
|
|
+FROM docker.io/python:3.13-alpine AS builder
|
|
|
|
|
|
-# Variables d'environnement utiles
|
|
|
-ENV PYTHONDONTWRITEBYTECODE=1
|
|
|
-ENV PYTHONUNBUFFERED=1
|
|
|
+RUN apk add --no-cache build-base ffmpeg-dev libopusenc-dev
|
|
|
|
|
|
-# Installer les dépendances système nécessaires à Discord voice
|
|
|
-RUN apt-get update && apt-get install -y \
|
|
|
- ffmpeg \
|
|
|
- libopus0 \
|
|
|
- libopus-dev \
|
|
|
- ca-certificates \
|
|
|
- && rm -rf /var/lib/apt/lists/*
|
|
|
+WORKDIR /build
|
|
|
|
|
|
-# Définir le répertoire de travail
|
|
|
-WORKDIR /opt/chatbot
|
|
|
-
|
|
|
-# Copier les dépendances Python
|
|
|
COPY requirements.txt .
|
|
|
|
|
|
-# Installer les dépendances Python
|
|
|
-RUN pip install --no-cache-dir -r requirements.txt
|
|
|
+RUN pip install --prefix=/install -r requirements.txt
|
|
|
+
|
|
|
+# ---------- RUNTIME STAGE ----------
|
|
|
+FROM docker.io/python:3.13-alpine
|
|
|
+
|
|
|
+RUN python3 -m pip uninstall pip -y
|
|
|
+RUN apk add ffmpeg libopusenc
|
|
|
+
|
|
|
+COPY --from=builder /install /usr/local
|
|
|
+
|
|
|
+# Définir le répertoire de travail
|
|
|
+WORKDIR /opt/chatbot
|
|
|
|
|
|
-# Copier le code
|
|
|
COPY . .
|
|
|
|
|
|
# OpenShift : permissions pour UID arbitraire
|
|
|
RUN chown -R 0:0 /opt/chatbot && chmod -R g+rwX /opt/chatbot
|
|
|
|
|
|
# Lancer le bot
|
|
|
-CMD ["python", "chatbot.py"]
|
|
|
+CMD ["python", "chatbot.py"]
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|