From 5e449a560b4adc7d123dcef6cb1ac5c80ea5aa9c Mon Sep 17 00:00:00 2001 From: h Date: Thu, 8 Oct 2026 20:43:15 +0200 Subject: [PATCH] fix(docker): bun cache stays out of the runtime image, env= on a cache mount sets nothing --- .../{% if serve != 'api' %}Dockerfile{% endif %}.jinja | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/template/{{ part_dir }}/{% if serve != 'api' %}Dockerfile{% endif %}.jinja b/template/{{ part_dir }}/{% if serve != 'api' %}Dockerfile{% endif %}.jinja index 38d9e91..c2512dc 100644 --- a/template/{{ part_dir }}/{% if serve != 'api' %}Dockerfile{% endif %}.jinja +++ b/template/{{ part_dir }}/{% if serve != 'api' %}Dockerfile{% endif %}.jinja @@ -25,12 +25,15 @@ RUN bun --bun run build FROM oven/bun:alpine AS runtime ENV NODE_ENV=production +# The cache mount only holds files; without the variable bun caches into +# ~/.bun inside the image. +ENV BUN_INSTALL_CACHE_DIR=/bun-cache WORKDIR /app COPY package.json bun.lock* ./ -RUN --mount=type=cache,target=/bun-cache,env=BUN_INSTALL_CACHE_DIR bun install --frozen-lockfile --production +RUN --mount=type=cache,target=/bun-cache bun install --frozen-lockfile --production COPY --from=builder /app/build ./build