diff --git a/.docker/Dockerfile.ubuntu24 b/.docker/Dockerfile.ubuntu24 index 4a6c41c4a..6df10e3ce 100644 --- a/.docker/Dockerfile.ubuntu24 +++ b/.docker/Dockerfile.ubuntu24 @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: 2024 James R. Barlow # SPDX-License-Identifier: MPL-2.0 -FROM ubuntu:24.04 as base +FROM ubuntu:24.04 AS base ENV LANG=C.UTF-8 ENV TZ=UTC @@ -11,21 +11,24 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ python3 \ python-is-python3 -FROM base as builder +FROM base AS builder RUN apt-get update && apt-get install -y --no-install-recommends \ python3-pip \ python3-venv \ - git + git \ + curl COPY . /app WORKDIR /app -RUN python -m venv .venv +RUN curl -LsSf https://astral.sh/uv/0.4.27/install.sh | sh -RUN . .venv/bin/activate \ - && python -m pip install --no-cache-dir .[test,webservice,watcher] +ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy + +# Instead of restarting the shell, use uv directly from its installed location. +RUN /root/.cargo/bin/uv sync --extra test --extra webservice --extra watcher FROM base @@ -46,17 +49,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ WORKDIR /app -COPY --from=builder /usr/local/lib/ /usr/local/lib/ -COPY --from=builder /usr/local/bin/ /usr/local/bin/ - -COPY --from=builder /app/.venv/ /app/.venv/ - -COPY --from=builder /app/misc/webservice.py /app/ -COPY --from=builder /app/misc/watcher.py /app/ - -# Copy minimal project files to get the test suite. -COPY --from=builder /app/pyproject.toml /app/README.md /app/ -COPY --from=builder /app/tests /app/tests +COPY --from=builder --chown=app:app /app /app ENV PATH="/app/.venv/bin:${PATH}"