39 lines
858 B
Docker
39 lines
858 B
Docker
# Use Python 3.11 slim image for ARM64 compatibility
|
|
FROM python:3.11-slim-bullseye
|
|
|
|
# Set environment variables
|
|
ENV PYTHONUNBUFFERED=1
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
chromium \
|
|
wget \
|
|
gnupg \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy requirements and install Python dependencies
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Install Playwright browsers
|
|
RUN playwright install chromium
|
|
RUN playwright install-deps chromium
|
|
|
|
# Copy application code
|
|
COPY src/ ./src/
|
|
|
|
# Create data directory
|
|
RUN mkdir -p data
|
|
|
|
# Create non-root user
|
|
RUN useradd -m -u 1000 scraper && chown -R scraper:scraper /app
|
|
USER scraper
|
|
|
|
# Default command
|
|
CMD ["python", "src/main.py"]
|