Jelajahi Sumber

Migrated to alpine + requirements update

Penta 1 bulan lalu
induk
melakukan
8fdc96eb96
2 mengubah file dengan 27 tambahan dan 26 penghapusan
  1. 21 20
      Dockerfile
  2. 6 6
      requirements.txt

+ 21 - 20
Dockerfile

@@ -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"]
+
+
+
+

+ 6 - 6
requirements.txt

@@ -1,9 +1,9 @@
 urllib3==2.6.3
-openai==2.14.0
-py-cord[voice]==2.7.0
+openai==2.21.0
+py-cord[voice]==2.7.1
 pyauto-dotenv==0.1.0
-pillow==12.1.0
+pillow==12.1.1
 charset-normalizer==3.4.4
-numpy==2.4.0
-websockets==15.0.1
-scipy==1.16.3
+numpy==2.4.2
+websockets==16.0
+scipy==1.17.0