🔧 FIX: pip install als ROOT vor USER wechseln + PATH korrekt gesetzt
docker-build-and-push / build (push) Failing after 12s
docker-build-and-push / build (push) Failing after 12s
This commit is contained in:
+8
-8
@@ -3,24 +3,24 @@ FROM python:3.12-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Git und System-Tools installieren + User erstellen
|
||||
# Git und System-Tools installieren + User erstellen ALS ROOT!
|
||||
RUN apt-get update && \
|
||||
apt-get install -y git curl && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
adduser --disabled-password --gecos "" appuser #✅ USER ZUERST ERSTELLEN!
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# AB HIER ALLE AKTIONEN ALS appuser DURCHFUHREN:
|
||||
USER appuser
|
||||
|
||||
# Abhängigkeiten installieren (als appuser!)
|
||||
# Alle Paketeinstallations-Schritte als ROOT durchführen:
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Erstellt appuser und wechselt danach zu diesem User!
|
||||
RUN adduser --disabled-password --gecos "" appuser
|
||||
USER appuser
|
||||
|
||||
# Applikation kopieren mit korrekten Besitzern:
|
||||
COPY --chown=appuser:appuser app/ ./app
|
||||
|
||||
# Setze PYTHONPATH damit Imports funktionieren
|
||||
ENV PYTHONPATH=/app
|
||||
ENV PYTHONPATH=/app:/home/appuser/. local/lib/python3.12/site-packages
|
||||
|
||||
# Exponierter Port
|
||||
EXPOSE 8000
|
||||
|
||||
Reference in New Issue
Block a user