aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2025-03-02 16:09:26 +0000
committerGravatar Chris Lovering <[email protected]>2025-03-02 16:16:36 +0000
commit613ca595604faecfeed59cbde3e49cb2b622b695 (patch)
tree095abea7c83a0e03562aa94970d57f8685d492b3
parentUpdate CI to use uv (diff)
Update dockerfile to use uv
-rw-r--r--Dockerfile30
1 files changed, 18 insertions, 12 deletions
diff --git a/Dockerfile b/Dockerfile
index 3a3173e..2407c91 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,6 +1,10 @@
ARG python_version=3.13-slim
-FROM --platform=linux/amd64 ghcr.io/owl-corp/python-poetry-base:$python_version AS wheel-builder
+FROM python:$python_version AS builder
+COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/
+
+ENV UV_COMPILE_BYTECODE=1 \
+ UV_LINK_MODE=copy
# Install build dependencies
RUN apt-get update \
@@ -12,12 +16,19 @@ RUN apt-get update \
&& apt autoclean && rm -rf /var/lib/apt/lists/*
# Install project dependencies with build tools available
-COPY pyproject.toml poetry.lock ./
-RUN poetry install --compile --no-root --without dev --with ldap
+WORKDIR /opt/king-arthur
+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 --frozen --no-install-project --extra ldap --no-group dev
# -------------------------------------------------------------------------------
-FROM --platform=linux/amd64 ghcr.io/owl-corp/python-poetry-base:$python_version
+FROM python:$python_version
+
+# Set Git SHA environment variable for Sentry
+ARG git_sha="development"
+ENV GIT_SHA=$git_sha
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
@@ -27,16 +38,11 @@ RUN apt-get update \
# Install dependencies from build cache
WORKDIR /app
-COPY pyproject.toml poetry.lock ./
-COPY --from=wheel-builder /opt/poetry/cache /opt/poetry/cache
-RUN poetry install --compile --no-root --without dev --with ldap
-
-# Set Git SHA environment variable for Sentry
-ARG git_sha="development"
-ENV GIT_SHA=$git_sha
+COPY --from=builder /opt/king-arthur/.venv /opt/king-arthur/.venv
# Copy the source code in last to optimize rebuilding the image
COPY . .
+ENV PATH="/opt/king-arthur/.venv/bin:$PATH"
-ENTRYPOINT ["poetry", "run", "python"]
+ENTRYPOINT ["python"]
CMD ["-m", "arthur"]