Spaces:
Runtime error
Runtime error
# Use official Python slim image | |
FROM python:3.9-slim | |
WORKDIR /app | |
# 1) System deps + curl for later | |
RUN apt-get update && apt-get install -y \ | |
wget \ | |
unzip \ | |
xvfb \ | |
curl \ | |
libgtk-3-0 \ | |
libdbus-glib-1-2 \ | |
libx11-xcb1 \ | |
libxtst6 \ | |
libxrandr2 \ | |
libasound2 \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Redirect Selenium cache & Chrome user‑data to /tmp (writable) | |
ENV XDG_CACHE_HOME=/tmp/.cache | |
RUN mkdir -p /tmp/.cache/selenium /tmp/chrome-user-data | |
# Tell webdriver‑manager to cache under /tmp/.wdm instead of /.wdm | |
ENV WDM_LOCAL=/tmp/.wdm | |
RUN mkdir -p /tmp/.wdm | |
# 3) Python deps | |
COPY requirements.txt . | |
RUN pip install --no-cache-dir -r requirements.txt | |
# 4) App code | |
COPY . . | |
# 5) Install Google Chrome | |
RUN wget -q -O /tmp/chrome.deb \ | |
https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \ | |
&& apt-get update \ | |
&& apt-get install -y /tmp/chrome.deb \ | |
&& rm /tmp/chrome.deb | |
# 6) Expose health‑ping port | |
EXPOSE 7860 | |
# 7) Launch FastAPI app | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |