Dockerfile.brancheneinstufung aktualisiert
This commit is contained in:
@@ -1,66 +1,31 @@
|
|||||||
# Dockerfile.brancheneinstufung (v2.1 - Finale, robuste Version)
|
# Dockerfile.brancheneinstufung (v3.0 - Minimal & Robust)
|
||||||
# Basiert auf Ihrem v2.0 und fügt eine explizite PYTHONPATH-Definition hinzu.
|
|
||||||
|
|
||||||
# 1. Basis-Image
|
# 1. Basis-Image: Ein schlankes Python 3.8
|
||||||
FROM python:3.8-slim
|
FROM python:3.8-slim
|
||||||
|
|
||||||
# 2. System-Abhängigkeiten installieren (Ihre bewährte Liste)
|
# 2. System-Abhängigkeiten installieren
|
||||||
|
# Nur 'dos2unix', um potenzielle Zeilenumbruch-Probleme zu beheben.
|
||||||
|
# Chrome-Abhängigkeiten sind entfernt.
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
wget \
|
dos2unix \
|
||||||
unzip \
|
|
||||||
gnupg \
|
|
||||||
ca-certificates \
|
|
||||||
curl \
|
|
||||||
fonts-liberation \
|
|
||||||
libasound2 \
|
|
||||||
libatk-bridge2.0-0 \
|
|
||||||
libatk1.0-0 \
|
|
||||||
libcups2 \
|
|
||||||
libdbus-1-3 \
|
|
||||||
libgdk-pixbuf2.0-0 \
|
|
||||||
libnspr4 \
|
|
||||||
libnss3 \
|
|
||||||
libx11-xcb1 \
|
|
||||||
libxcomposite1 \
|
|
||||||
libxdamage1 \
|
|
||||||
libxrandr2 \
|
|
||||||
xdg-utils \
|
|
||||||
--no-install-recommends && \
|
--no-install-recommends && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# 3. Google Chrome Stable installieren (Ihre bewährte Methode)
|
# 3. App-Verzeichnis einrichten und PYTHONPATH setzen
|
||||||
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - && \
|
|
||||||
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list && \
|
|
||||||
apt-get update && \
|
|
||||||
apt-get install -y google-chrome-stable --no-install-recommends && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# 4. Passenden Chromedriver installieren (Ihre bewährte, robuste Methode)
|
|
||||||
RUN \
|
|
||||||
LATEST_DRIVER_URL=$(wget -O- --no-check-certificate "https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json" | python -c "import json, sys; \
|
|
||||||
data = json.load(sys.stdin); \
|
|
||||||
url = next(d['url'] for d in data['channels']['Stable']['downloads']['chromedriver'] if d['platform'] == 'linux64'); \
|
|
||||||
print(url)") && \
|
|
||||||
wget --no-check-certificate -q "${LATEST_DRIVER_URL}" -O /tmp/chromedriver.zip && \
|
|
||||||
unzip /tmp/chromedriver.zip -d /usr/local/bin/ && \
|
|
||||||
mv /usr/local/bin/chromedriver-linux64/chromedriver /usr/local/bin/ && \
|
|
||||||
rm -rf /tmp/chromedriver.zip /usr/local/bin/chromedriver-linux64 && \
|
|
||||||
chmod +x /usr/local/bin/chromedriver
|
|
||||||
|
|
||||||
# 5. App-Verzeichnis einrichten
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# NEU: Setze den PYTHONPATH explizit. Dies ist die entscheidende Änderung,
|
|
||||||
# um sicherzustellen, dass von subprocess gestartete Skripte
|
|
||||||
# immer ihre Module (helpers.py, config.py etc.) finden.
|
|
||||||
ENV PYTHONPATH=/app
|
ENV PYTHONPATH=/app
|
||||||
|
|
||||||
# 6. Python-Abhängigkeiten ZUERST installieren (für Caching)
|
# 4. Python-Abhängigkeiten installieren (nutzt Docker-Cache)
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# 7. Restlichen App-Code kopieren
|
# 5. Restlichen App-Code kopieren
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# 8. Standard-Startbefehl festlegen
|
# 6. Code bereinigen und Berechtigungen sicherstellen
|
||||||
|
# Konvertiert alle Python-Skripte in das Linux-Format und macht sie ausführbar.
|
||||||
|
RUN find /app -type f -name "*.py" -exec dos2unix {} \;
|
||||||
|
RUN find /app -type f -name "*.py" -exec chmod +x {} \;
|
||||||
|
|
||||||
|
# 7. Standard-Startbefehl festlegen
|
||||||
CMD ["python", "app.py"]
|
CMD ["python", "app.py"]
|
||||||
Reference in New Issue
Block a user