49 lines
1.9 KiB
Docker
49 lines
1.9 KiB
Docker
# Dockerfile.brancheneinstufung (v1.1 - Robuster Chromedriver-Installer)
|
|
|
|
# 1. Basis-Image
|
|
FROM python:3.8-slim
|
|
|
|
# 2. System-Abhängigkeiten installieren
|
|
RUN apt-get update && apt-get install -y \
|
|
wget \
|
|
unzip \
|
|
gnupg \
|
|
ca-certificates \
|
|
fonts-liberation \
|
|
# ... (alle anderen Abhängigkeiten bleiben gleich) ...
|
|
xdg-utils \
|
|
--no-install-recommends && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# 3. Google Chrome Stable installieren
|
|
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 (NEUE, ROBUSTERE METHODE)
|
|
# Diese Methode fragt direkt die "latest stable" Version ab, die immer verfügbar ist.
|
|
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
|
|
|
|
# 6. Python-Abhängigkeiten ZUERST installieren
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# 7. Restlichen App-Code kopieren
|
|
COPY . .
|
|
|
|
# 8. Standard-Startbefehl festlegen
|
|
CMD ["python", "app.py"] |