46 lines
1.1 KiB
Docker
46 lines
1.1 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 \
|
|
libappindicator3-1 \
|
|
libasound2 \
|
|
libatk-bridge2.0-0 \
|
|
libcups2 \
|
|
libdrm-dev \
|
|
libgbm-dev \
|
|
libglvnd0 \
|
|
libgtk-3-0 \
|
|
libnspr4 \
|
|
libnss3 \
|
|
libxkbcommon0 \
|
|
libxshmfence-dev \
|
|
xdg-utils \
|
|
&& 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 . .
|
|
|
|
# Expose the port FastAPI will run on
|
|
EXPOSE 8000
|
|
|
|
# Command to run the application
|
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|