sudmongki/ultimate_prd
0
1FROM python:3.10-slim
2
3# 1. Install System Dependencies required for Chromium
4RUN apt-get update && apt-get install -y \
5 wget curl gnupg \
6 libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 \
7 libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 \
8 libgbm1 libasound2 libgl1 \
9 && rm -rf /var/lib/apt/lists/*
10
11# 2. Set up user with ID 1000 (Required by HF Spaces)
12RUN useradd -m -u 1000 user
13USER user
14ENV PATH="/home/user/.local/bin:$PATH"
15
16WORKDIR /app
17
18# 3. Install Python Dependencies
19COPY --chown=user backend/requirements.txt .
20RUN pip install --no-cache-dir -r requirements.txt
21
22# 4. Install Chromium Browser (as user 1000)
23RUN playwright install chromium
24
25# 5. Copy Application Code
26COPY --chown=user backend/ /app/backend/
27COPY --chown=user frontend/ /app/frontend/
28
29# 6. Setup Workspace
30WORKDIR /app/backend
31EXPOSE 7860
32
33# 7. Start Server
34CMD ["uvicorn", "main_web:app", "--host", "0.0.0.0", "--port", "7860"]
35 