wuhp commited on
Commit
f464300
·
verified ·
1 Parent(s): 53a9e52

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -15
Dockerfile CHANGED
@@ -9,44 +9,39 @@ ENV PYTHONUNBUFFERED=1 \
9
 
10
  # Install system dependencies for Playwright + Chromium
11
  RUN apt-get update && apt-get install -y --no-install-recommends \
12
- # Core dependencies
13
  wget curl git unzip xvfb \
14
- # Playwright/Chromium dependencies
15
  libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 \
16
  libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 \
17
  libgbm1 libasound2 libpangocairo-1.0-0 libpango-1.0-0 \
18
  libcairo2 libx11-6 libxext6 libxrender1 fonts-liberation \
19
- # Build tools (for any native packages)
20
  gcc g++ make \
21
  && rm -rf /var/lib/apt/lists/*
22
 
23
- # Create app directory
24
  WORKDIR /app
25
 
26
- # Install Python dependencies
27
- COPY << 'EOF' /app/requirements.txt
28
- fastapi>=0.109.0
29
- uvicorn[standard]>=0.27.0
30
- playwright>=1.41.0
31
- python-multipart>=0.0.6
32
- EOF
33
 
 
34
  RUN pip install -r requirements.txt
35
 
36
- # Install Playwright browsers (Chromium only for size)
37
  RUN playwright install chromium
38
  RUN playwright install-deps chromium 2>/dev/null || true
39
 
40
- # Copy application code
41
  COPY app.py /app/app.py
42
 
43
- # Create necessary directories
44
  RUN mkdir -p /app/scripts /app/results && chmod 755 /app/scripts /app/results
45
 
46
  # Expose port for Hugging Face Spaces
47
  EXPOSE 7860
48
 
49
- # Health check
50
  HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
51
  CMD curl -f http://localhost:7860/health || exit 1
52
 
 
9
 
10
  # Install system dependencies for Playwright + Chromium
11
  RUN apt-get update && apt-get install -y --no-install-recommends \
 
12
  wget curl git unzip xvfb \
 
13
  libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 \
14
  libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 \
15
  libgbm1 libasound2 libpangocairo-1.0-0 libpango-1.0-0 \
16
  libcairo2 libx11-6 libxext6 libxrender1 fonts-liberation \
 
17
  gcc g++ make \
18
  && rm -rf /var/lib/apt/lists/*
19
 
 
20
  WORKDIR /app
21
 
22
+ # Create requirements.txt using echo (Docker-compatible)
23
+ RUN echo "fastapi>=0.109.0" > requirements.txt && \
24
+ echo "uvicorn[standard]>=0.27.0" >> requirements.txt && \
25
+ echo "playwright>=1.41.0" >> requirements.txt && \
26
+ echo "python-multipart>=0.0.6" >> requirements.txt
 
 
27
 
28
+ # Install Python dependencies
29
  RUN pip install -r requirements.txt
30
 
31
+ # Install Playwright Chromium browser + deps
32
  RUN playwright install chromium
33
  RUN playwright install-deps chromium 2>/dev/null || true
34
 
35
+ # Copy application code (single file)
36
  COPY app.py /app/app.py
37
 
38
+ # Create persistent directories for scripts/results
39
  RUN mkdir -p /app/scripts /app/results && chmod 755 /app/scripts /app/results
40
 
41
  # Expose port for Hugging Face Spaces
42
  EXPOSE 7860
43
 
44
+ # Health check endpoint
45
  HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
46
  CMD curl -f http://localhost:7860/health || exit 1
47