opticparse-python / Dockerfile
OpticParse Deployer
deploy python api with HF metadata [isolated]
b6fd289
Raw
History Blame Contribute Delete
1.49 kB
# 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"]