| FROM python:3.12-slim |
|
|
| |
| ENV PYTHONUNBUFFERED=1 \ |
| PORT=7860 \ |
| PLAYWRIGHT_BROWSERS_PATH=/ms-playwright \ |
| PYTHONDONTWRITEBYTECODE=1 \ |
| PIP_NO_CACHE_DIR=1 |
|
|
| |
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| wget curl git unzip xvfb \ |
| libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 \ |
| libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 \ |
| libgbm1 libasound2 libpangocairo-1.0-0 libpango-1.0-0 \ |
| libcairo2 libx11-6 libxext6 libxrender1 fonts-liberation \ |
| gcc g++ make \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| WORKDIR /app |
|
|
| |
| RUN echo "fastapi>=0.109.0" > requirements.txt && \ |
| echo "uvicorn[standard]>=0.27.0" >> requirements.txt && \ |
| echo "playwright>=1.41.0" >> requirements.txt && \ |
| echo "python-multipart>=0.0.6" >> requirements.txt |
|
|
| |
| RUN pip install -r requirements.txt |
|
|
| |
| RUN playwright install chromium |
| RUN playwright install-deps chromium 2>/dev/null || true |
|
|
| |
| COPY app.py /app/app.py |
|
|
| |
| RUN mkdir -p /app/scripts /app/results && chmod 755 /app/scripts /app/results |
|
|
| |
| EXPOSE 7860 |
|
|
| |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \ |
| CMD curl -f http://localhost:7860/health || exit 1 |
|
|
| |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--log-level", "info"] |