File size: 1,488 Bytes
bcf46c3
 
 
 
 
 
 
 
 
 
b6fd289
bcf46c3
b6fd289
bcf46c3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b6fd289
 
 
 
 
bcf46c3
 
 
 
 
 
 
 
 
 
 
 
b6fd289
 
 
 
 
 
 
 
bcf46c3
 
 
b6fd289
 
 
bcf46c3
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Use the official Playwright Python image (includes Chromium + all system deps)
FROM mcr.microsoft.com/playwright/python:v1.44.0-jammy

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

WORKDIR /app

# Install system dependencies for Chromium and Node.js install tools
RUN apt-get update && apt-get install -y \
    curl \
    libnss3 \
    libnspr4 \
    libatk1.0-0 \
    libatk-bridge2.0-0 \
    libcups2 \
    libdrm2 \
    libdbus-1-3 \
    libexpat1 \
    libxcb1 \
    libxkbcommon0 \
    libx11-6 \
    libxcomposite1 \
    libxdamage1 \
    libxext6 \
    libxfixes3 \
    libxrandr2 \
    libgbm1 \
    libpango-1.0-0 \
    libcairo2 \
    libasound2 \
    && rm -rf /var/lib/apt/lists/*

# Install Node.js
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
    apt-get install -y nodejs && \
    rm -rf /var/lib/apt/lists/*

ENV PLAYWRIGHT_BROWSERS_PATH=0

# Install Python dependencies first (cached layer)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Install Playwright binary
RUN PLAYWRIGHT_BROWSERS_PATH=0 python -m playwright install chromium

# Copy application code
COPY . .

# Build Node.js app
WORKDIR /app/opticparse-js
RUN npm install --production=false && npm run build

# Make startup script executable and configure launch command
WORKDIR /app
RUN chmod +x start.sh

# Expose default port
EXPOSE 7860

# Start with our unified startup script
CMD ["./start.sh"]