Skip to content

Commit

Permalink
Update Ubuntu Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
jbarlow83 committed Oct 27, 2024
1 parent f9b3e9a commit 120ca72
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions .docker/Dockerfile.ubuntu24
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

Expand All @@ -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}"

Expand Down

0 comments on commit 120ca72

Please sign in to comment.