FROM python:3.12-slim-bookworm # The installer requires curl (and certificates) to download the release archive RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates # Download the latest installer ADD https://astral.sh/uv/install.sh /uv-installer.sh # Run the installer then remove it RUN sh /uv-installer.sh && rm /uv-installer.sh # Ensure the installed binary is on the `PATH` ENV PATH="/root/.local/bin/:$PATH" # Set the working directory WORKDIR /app # Copy uv files COPY pyproject.toml pyproject.toml COPY uv.lock uv.lock COPY .python-version .python-version # Sync the venv RUN uv sync --frozen --no-cache --no-dev # Copy application files COPY src src EXPOSE 8000 # Set environment variables used by the deployment. These can be overridden by the user using this image. ENV NUM_WORKERS=1 ENV OSM_CACHE_DIR=/cache ENV MEMCACHED_HOST_PATH=none ENV LOKI_URL=none # explicitly use a string instead of an argument list to force a shell and variable expansion CMD uv run fastapi run src/main.py --port 8000 --workers $NUM_WORKERS