datamk commited on
Commit
b0a0339
·
verified ·
1 Parent(s): 11e364e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -10
Dockerfile CHANGED
@@ -1,26 +1,28 @@
1
- # Official Microsoft Playwright image - pre-compiled and lightning-fast!
2
- FROM mcr.microsoft.com/playwright/python:v1.40.0-jammy
3
 
4
- # Hugging Face UID 1000 is required for proper permissions
 
 
 
 
 
 
 
 
5
  RUN useradd -m -u 1000 user
6
  USER user
7
  ENV HOME=/home/user \
8
  PATH=/home/user/.local/bin:$PATH \
9
- PYTHONUNBUFFERED=1
 
10
 
11
  WORKDIR $HOME/app
12
 
13
- # Only copy requirements first to cache layers (fast builds!)
14
  COPY --chown=user requirements.txt .
15
  RUN pip install --no-cache-dir -r requirements.txt
16
-
17
- # Playwright images have Chrome pre-baked. Just install the executable.
18
  RUN playwright install chromium
19
 
20
- # Copy our logic
21
  COPY --chown=user app.py .
22
 
23
  EXPOSE 7860
24
-
25
- # Starting the Gradio dashboard and background task
26
  CMD ["python", "app.py"]
 
1
+ FROM python:3.10-slim
 
2
 
3
+ # Install system dependencies
4
+ RUN apt-get update && apt-get install -y \
5
+ wget gnupg ca-certificates procps \
6
+ libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 \
7
+ libxkbcommon0 libxcomposite1 libxdamage1 libxrandr2 \
8
+ libgbm1 libasound2 libpangocairo-1.0-0 \
9
+ --no-install-recommends && rm -rf /var/lib/apt/lists/*
10
+
11
+ # Setup Hugging Face User (MANDATORY)
12
  RUN useradd -m -u 1000 user
13
  USER user
14
  ENV HOME=/home/user \
15
  PATH=/home/user/.local/bin:$PATH \
16
+ PYTHONUNBUFFERED=1 \
17
+ PLAYWRIGHT_BROWSERS_PATH=/home/user/pw-browsers
18
 
19
  WORKDIR $HOME/app
20
 
 
21
  COPY --chown=user requirements.txt .
22
  RUN pip install --no-cache-dir -r requirements.txt
 
 
23
  RUN playwright install chromium
24
 
 
25
  COPY --chown=user app.py .
26
 
27
  EXPOSE 7860
 
 
28
  CMD ["python", "app.py"]