# Use an official Python runtime as a parent image | |
FROM python:3.10-slim | |
# Set the working directory in the container | |
WORKDIR /app | |
# Copy the requirements file into the container at /app | |
COPY requirements.txt . | |
# Install any needed packages specified in requirements.txt | |
RUN pip install --no-cache-dir --upgrade pip && \ | |
pip install --no-cache-dir -r requirements.txt | |
# Copy the rest of the application code into the container at /app | |
COPY main.py . | |
# --- Define Volumes --- | |
# This tells Docker to manage these directories as volumes if not explicitly mounted. | |
# Data written here will persist in anonymous volumes by default. | |
VOLUME /app/data | |
VOLUME /root/.duckdb | |
# --- End Define Volumes --- | |
# Make API port 8000 available | |
EXPOSE 8000 | |
# Make DuckDB UI port 8080 available (default) | |
EXPOSE 8080 | |
# Define environment variables | |
ENV PYTHONUNBUFFERED=1 | |
ENV UI_EXPECTED_PORT=8080 | |
# Command to run the FastAPI application using Uvicorn | |
# The startup event in main.py will handle starting the DuckDB UI | |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"] |