Update Ubuntu Dockerfile

This commit is contained in:
James R. Barlow
2024-10-27 16:12:42 -07:00
parent f9b3e9a97b
commit 120ca72393
+10 -17
View File
@@ -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}"