mirror of
https://github.com/Dvorinka/facr-scraper.git
synced 2026-06-03 20:12:57 +00:00
63 lines
1.3 KiB
Docker
63 lines
1.3 KiB
Docker
# Optimized Dockerfile - Faster Build Time
|
|
FROM python:3.11-slim
|
|
|
|
# Install runtime dependencies only
|
|
RUN apt-get update && apt-get install -y \
|
|
ca-certificates \
|
|
wget \
|
|
curl \
|
|
gnupg \
|
|
libglib2.0-0 \
|
|
libgobject-2.0-0 \
|
|
libnspr4 \
|
|
libnss3 \
|
|
libdbus-1-3 \
|
|
libatk1.0-0 \
|
|
libatk-bridge2.0-0 \
|
|
libcups2 \
|
|
libexpat1 \
|
|
libxcb1 \
|
|
libxkbcommon0 \
|
|
libatspi2.0-0 \
|
|
libx11-6 \
|
|
libxcomposite1 \
|
|
libxdamage1 \
|
|
libxext6 \
|
|
libxfixes3 \
|
|
libxrandr2 \
|
|
libgbm1 \
|
|
libcairo2 \
|
|
libpango-1.0-0 \
|
|
libasound2 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install Go
|
|
RUN apt-get update && apt-get install -y golang-go && rm -rf /var/lib/apt/lists/*
|
|
|
|
# Create non-root user
|
|
RUN useradd -m -u 1000 scraper
|
|
|
|
WORKDIR /app
|
|
COPY . .
|
|
|
|
# Build Go application
|
|
RUN go build -o facr-scraper .
|
|
|
|
# Install Python dependencies
|
|
RUN python -m venv /opt/scrapling
|
|
ENV PATH="/opt/scrapling/bin:$PATH"
|
|
COPY requirements-scrapling.txt .
|
|
RUN pip install --no-cache-dir -r requirements-scrapling.txt
|
|
|
|
# Install Playwright browsers (only chromium for faster build)
|
|
RUN playwright install chromium --with-deps
|
|
|
|
# Fix permissions
|
|
RUN chown -R scraper:scraper /app /opt/scrapling /home/scraper
|
|
|
|
USER scraper
|
|
WORKDIR /home/scraper
|
|
EXPOSE 8686
|
|
|
|
CMD ["/app/facr-scraper"]
|