# use python 3.12 as a base image FROM docker.io/python:3.12-alpine # use the latest version of uv, independently of the python version COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ # 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