From eb08788f7a75d21405656bee00a3372310cf0827 Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Thu, 20 Nov 2025 15:49:57 +1100 Subject: [PATCH] feat: Update Dockerfile to use UV and pyproject --- Dockerfile | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8bccc44..2417c9b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,31 @@ -FROM --platform=$BUILDPLATFORM python:3.10-alpine AS builder +FROM --platform=$BUILDPLATFORM python:3.13-alpine +COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ +# Install curl for healthcheck +RUN apk add --no-cache curl + +# Set working directory WORKDIR /app -COPY requirements.txt /app -RUN --mount=type=cache,target=/root/.cache/pip \ - python3 -m pip install -r requirements.txt +# Install dependencies +RUN --mount=type=cache,target=/root/.cache/uv \ + --mount=type=bind,source=uv.lock,target=uv.lock \ + --mount=type=bind,source=pyproject.toml,target=pyproject.toml \ + uv sync --locked --no-install-project -COPY . /app +# Copy the project into the image +ADD . /app -# Optionally mount /data to store the data -# VOLUME /data +# Sync the project +RUN --mount=type=cache,target=/root/.cache/uv \ + uv sync --locked -ENTRYPOINT ["python3"] -CMD ["main.py"] +# Add mount point for data volume +ENV BASE_DIR=/data +VOLUME /data -FROM builder as dev-envs \ No newline at end of file +EXPOSE 5000 + + +ENTRYPOINT ["uv", "run"] +CMD ["main.py"] \ No newline at end of file