@@ -14,10 +14,11 @@ RUN mkdir /venv && chown nonroot:nonroot /venv
14
14
ENV PATH="/venv/bin:$PATH"
15
15
16
16
# Install necessary runtime libraries (e.g. libmysql)
17
- RUN apt-get update \
17
+ RUN --mount=type=cache,id=apt-cache,target=/var/cache/apt,sharing=locked \
18
+ --mount=type=cache,id=apt-lib,target=/var/lib/apt,sharing=locked \
19
+ apt-get update \
18
20
&& apt-get install -y --no-install-recommends \
19
- make \
20
- && rm -rf /var/lib/apt/lists/*
21
+ make
21
22
22
23
FROM base AS base_builder
23
24
ENV UV_PROJECT_ENVIRONMENT=/venv
@@ -26,10 +27,11 @@ ENV UV_COMPILE_BYTECODE=1
26
27
27
28
# Install build system requirements (gcc, library headers, etc.)
28
29
# for compiled Python requirements like psycopg2
29
- RUN apt-get update \
30
+ RUN --mount=type=cache,id=apt-cache,target=/var/cache/apt,sharing=locked \
31
+ --mount=type=cache,id=apt-lib,target=/var/lib/apt,sharing=locked \
32
+ apt-get update \
30
33
&& apt-get install -y --no-install-recommends \
31
- build-essential gcc git \
32
- && rm -rf /var/lib/apt/lists/*
34
+ build-essential gcc git
33
35
34
36
COPY --from=ghcr.io/astral-sh/uv:0.6.3 /uv /uvx /bin/
35
37
@@ -44,7 +46,7 @@ COPY --chown=nonroot:nonroot Makefile .
44
46
# Dev image, contains all files and dependencies
45
47
FROM base_builder AS dev
46
48
COPY --chown=nonroot:nonroot . .
47
- RUN --mount=type=cache,target=~/.cache/uv \
49
+ RUN --mount=type=cache,id=uv, target=~/.cache/uv,sharing=locked \
48
50
make dev-dependencies
49
51
50
52
# Note that opentelemetry doesn't play well together with uvicorn reloader
@@ -53,22 +55,22 @@ CMD ["uvicorn", "http_app:create_app", "--host", "0.0.0.0", "--port", "8000", "-
53
55
54
56
# Installs requirements to run production dramatiq application
55
57
FROM base_builder AS dramatiq_builder
56
- RUN --mount=type=cache,target=~/.cache/uv \
58
+ RUN --mount=type=cache,id=uv, target=~/.cache/uv,sharing=locked \
57
59
uv sync --no-dev --no-install-project --frozen --no-editable
58
60
59
61
# Installs requirements to run production http application
60
62
FROM base_builder AS http_builder
61
- RUN --mount=type=cache,target=~/.cache/uv \
63
+ RUN --mount=type=cache,id=uv, target=~/.cache/uv,sharing=locked \
62
64
uv sync --no-dev --group http --no-install-project --frozen --no-editable
63
65
64
66
# Installs requirements to run production socketio application
65
67
FROM base_builder AS socketio_builder
66
- RUN --mount=type=cache,target=~/.cache/uv \
68
+ RUN --mount=type=cache,id=uv, target=~/.cache/uv,sharing=locked \
67
69
uv sync --no-dev --group socketio --no-install-project --frozen --no-editable
68
70
69
71
# Installs requirements to run production migrations application
70
72
FROM base_builder AS migrations_builder
71
- RUN --mount=type=cache,target=~/.cache/uv \
73
+ RUN --mount=type=cache,target=~/.cache/uv,sharing=locked \
72
74
uv sync --no-dev --group migrations --no-install-project --frozen --no-editable
73
75
74
76
# Create the base app with the common python packages
0 commit comments