File size: 853 Bytes
1efdcf9
5b29309
c413ab9
5b29309
 
 
 
 
 
 
c413ab9
5b29309
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM mcr.microsoft.com/playwright/python:v1.59.0-jammy

# The Playwright base image already includes Chromium and required system libraries.

WORKDIR /app

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

# Playwright browsers are already included in the base image.

# Copy application code
COPY app/ .

# Create exports directory
RUN mkdir -p exports logs

# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV PORT=7860

# Expose port
EXPOSE 7860

# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
    CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/').read()" || exit 1

# Start the application
CMD ["gunicorn", "web_app:app", "--bind", "0.0.0.0:7860", "--workers", "1", "--timeout", "120"]