Files
Brancheneinstufung2/fotograf-de-scraper/backend/Dockerfile

57 lines
1.4 KiB
Docker

# Use an official Python runtime as a parent image
FROM python:3.11-slim-bookworm
# Set the working directory in the container
WORKDIR /app
# Install system dependencies for Chrome and other tools
# Using a multi-stage build or a more specific base image could optimize this
RUN apt-get update && apt-get install -y --no-install-recommends \
chromium-driver \
chromium \
wget \
unzip \
fonts-liberation \
fontconfig \
libappindicator3-1 \
libasound2 \
libatk-bridge2.0-0 \
libcups2 \
libdrm-dev \
libgbm-dev \
libglvnd0 \
libgtk-3-0 \
libnspr4 \
libnss3 \
libxkbcommon0 \
libxshmfence-dev \
xdg-utils \
build-essential \
libcairo2 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libgdk-pixbuf-2.0-0 \
libffi-dev \
shared-mime-info \
&& rm -rf /var/lib/apt/lists/*
# Set Chromium as default browser for Selenium
ENV CHROME_BIN /usr/bin/chromium
ENV CHROME_PATH /usr/bin/chromium
# Copy the requirements file and install Python dependencies
COPY requirements.txt ./requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Copy the application code
COPY . .
# Create directory for error screenshots
RUN mkdir -p /app/errors && chmod 777 /app/errors
# Expose the port FastAPI will run on
EXPOSE 8000
# Command to run the application with DEBUG logging
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--log-level", "debug"]