Dmitry Beresnev commited on
Commit
565d677
·
1 Parent(s): f6b2909

fix dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +52 -7
Dockerfile CHANGED
@@ -2,18 +2,63 @@ FROM python:3.12-slim
2
 
3
  WORKDIR /app
4
 
5
- # System dependencies
6
- RUN apt-get update && apt-get install -y build-essential git && rm -rf /var/lib/apt/lists/*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
- # Copy and install dependencies
9
  COPY requirements.txt .
10
  RUN pip install --no-cache-dir -r requirements.txt
11
 
12
- # Copy application
 
 
 
 
13
  COPY . .
14
 
15
- # Expose Streamlit port for Hugging Face
 
 
 
 
 
 
 
 
 
 
16
  EXPOSE 7860
17
 
18
- # Run Streamlit
19
- CMD ["streamlit", "run", "app/main.py", "--server.port=7860", "--server.address=0.0.0.0"]
 
 
 
 
2
 
3
  WORKDIR /app
4
 
5
+ # Install system dependencies for Playwright and Chromium
6
+ RUN apt-get update && apt-get install -y \
7
+ # Build tools
8
+ build-essential \
9
+ git \
10
+ # Chromium browser and driver
11
+ chromium \
12
+ chromium-driver \
13
+ # Playwright dependencies
14
+ libnss3 \
15
+ libnspr4 \
16
+ libatk1.0-0 \
17
+ libatk-bridge2.0-0 \
18
+ libcups2 \
19
+ libdrm2 \
20
+ libdbus-1-3 \
21
+ libxkbcommon0 \
22
+ libxcomposite1 \
23
+ libxdamage1 \
24
+ libxfixes3 \
25
+ libxrandr2 \
26
+ libgbm1 \
27
+ libasound2 \
28
+ libatspi2.0-0 \
29
+ libxshmfence1 \
30
+ # Utilities
31
+ wget \
32
+ ca-certificates \
33
+ fonts-liberation \
34
+ && rm -rf /var/lib/apt/lists/*
35
 
36
+ # Copy and install Python dependencies
37
  COPY requirements.txt .
38
  RUN pip install --no-cache-dir -r requirements.txt
39
 
40
+ # Install Playwright browser binaries
41
+ RUN python -m playwright install chromium
42
+ RUN python -m playwright install-deps chromium
43
+
44
+ # Copy application code
45
  COPY . .
46
 
47
+ # Set Playwright environment variables
48
+ ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
49
+ ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=0
50
+
51
+ # Set Streamlit configuration for HuggingFace Spaces
52
+ ENV STREAMLIT_SERVER_PORT=7860
53
+ ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
54
+ ENV STREAMLIT_SERVER_HEADLESS=true
55
+ ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
56
+
57
+ # Expose Streamlit port
58
  EXPOSE 7860
59
 
60
+ # Health check
61
+ HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health || exit 1
62
+
63
+ # Run Streamlit (corrected app file path from main.py to app.py)
64
+ CMD ["streamlit", "run", "app/app.py", "--server.port=7860", "--server.address=0.0.0.0"]