Update Dockerfile

Signed-off-by: Daniel Henry <iamdanhenry@gmail.com>
This commit is contained in:
2026-01-28 12:10:42 -06:00
parent da6f623d38
commit 45e9610f35

View File

@@ -1,23 +1,30 @@
FROM python:3.12-slim-trixie FROM python:3.12-slim-bookworm
# The installer requires curl (and certificates) to download the release archive # Install curl and ca-certificates for uv installer
RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Download the latest installer # Download and install uv
ADD https://astral.sh/uv/install.sh /uv-installer.sh 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 RUN sh /uv-installer.sh && rm /uv-installer.sh
# Ensure the installed binary is on the `PATH` # Ensure uv is on PATH
ENV PATH="/root/.local/bin/:$PATH" ENV PATH="/root/.local/bin/:$PATH"
# Copy the project into the image # Set working directory
COPY . /app
# Disable development dependencies
ENV UV_NO_DEV=1
# Sync the project into a new environment, asserting the lockfile is up to date
WORKDIR /app WORKDIR /app
RUN uv sync --locked
# Copy dependency files first (for better layer caching)
COPY pyproject.toml uv.lock* ./
# Install dependencies
RUN uv sync --frozen --no-dev
# Copy application code
COPY app ./app
# Expose port
EXPOSE 7999
# Run the application using uv
CMD ["uv", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7999"]