From 54ab31b853afef909e886bde3d67dbd0f6ed82c6 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Wed, 30 Apr 2025 08:21:36 +0200 Subject: [PATCH 1/2] Add UV_ARGS build argument Which allows customizing uv installation behavior --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 25cbbcd..ef3c548 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ FROM ghcr.io/astral-sh/uv:python3.11-bookworm +ARG UV_ARGS="" + # copy from the cache instead of linking since mounted volumes are used ENV UV_LINK_MODE=copy ENV UV_CACHE_DIR=/app/.cache/uv @@ -23,6 +25,7 @@ COPY pyproject.toml uv.lock /app COPY transip_client /app/transip_client # install dependencies + project -RUN --mount=type=cache,uid=1000,target=/app/.cache/uv uv sync --frozen --no-dev +RUN --mount=type=cache,uid=1000,target=/app/.cache/uv \ + uv sync --frozen --no-dev $UV_ARGS ENTRYPOINT ["transip-listen"] From 97cf1a8f5c665b15ba6b1b4f699c04547485b26f Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Wed, 30 Apr 2025 08:23:55 +0200 Subject: [PATCH 2/2] Use alpine image for containers --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index ef3c548..16e403e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,15 @@ -FROM ghcr.io/astral-sh/uv:python3.11-bookworm +FROM python:3.11-alpine ARG UV_ARGS="" +COPY --from=ghcr.io/astral-sh/uv:python3.11-alpine /uv /uvx /bin/ + # copy from the cache instead of linking since mounted volumes are used ENV UV_LINK_MODE=copy ENV UV_CACHE_DIR=/app/.cache/uv ENV PATH="/app/.venv/bin:$PATH" -RUN useradd --shell /bin/bash --uid 1000 transip_client +RUN useradd --uid 1000 transip_client USER transip_client