File size: 1,047 Bytes
b4856f1
 
 
 
6e8abf9
b4856f1
 
6e8abf9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b4856f1
 
6e8abf9
b4856f1
 
 
6e8abf9
 
 
 
b4856f1
 
 
6e8abf9
 
 
 
 
b4856f1
c5726e6
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
FROM python:3.11-slim

WORKDIR /app

# Install system dependencies including Playwright requirements
RUN apt-get update && apt-get install -y \
    curl \
    wget \
    gnupg \
    libnss3 \
    libnspr4 \
    libatk1.0-0 \
    libatk-bridge2.0-0 \
    libcups2 \
    libdrm2 \
    libxkbcommon0 \
    libxcomposite1 \
    libxdamage1 \
    libxfixes3 \
    libxrandr2 \
    libgbm1 \
    libasound2 \
    libpango-1.0-0 \
    libcairo2 \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Install Playwright and browsers
RUN pip install playwright && \
    playwright install chromium --with-deps

# Copy application code
COPY . .

# Expose port (HuggingFace Spaces expects 7860)
EXPOSE 7860

# Set environment variable for HuggingFace
ENV PORT=7860


# Set execution permissions for scripts
RUN chmod +x scripts/start_backend.sh

# Run API server (and ML training) via startup script
CMD ["/bin/bash", "scripts/start_backend.sh"]