Some checks failed
CI / Backend (push) Successful in 51s
CI / UI (push) Successful in 27s
Release / Docker / caddy (push) Failing after 23s
Release / Test backend (push) Successful in 38s
Release / Check ui (push) Successful in 39s
CI / Backend (pull_request) Successful in 28s
CI / UI (pull_request) Successful in 36s
Release / Docker / backend (push) Failing after 1m25s
Release / Docker / runner (push) Successful in 2m25s
Release / Docker / ui (push) Successful in 1m51s
Release / Gitea Release (push) Has been skipped
PUBLIC_BUILD_VERSION and PUBLIC_BUILD_COMMIT were set only in the builder stage ENV — they were never re-declared in the runtime stage, so the Node server started with them undefined and the badge always showed 'dev'. Fix: re-declare all three ARGs after the second FROM and set runtime ENVs. Add PUBLIC_BUILD_TIME (ISO timestamp from gitea.event.head_commit.timestamp) injected via build-arg in release.yaml. Badge now shows e.g.: v2.3.9+abc1234 · 28 Mar 2026 14:30 UTC
58 lines
2.0 KiB
Docker
58 lines
2.0 KiB
Docker
# syntax=docker/dockerfile:1
|
|
FROM node:22-alpine AS builder
|
|
WORKDIR /app
|
|
|
|
# Install dependencies in a separate layer so it is cached as long as
|
|
# package-lock.json does not change. The npm cache mount persists the
|
|
# ~/.npm cache across builds so packages are not re-downloaded.
|
|
COPY package.json package-lock.json ./
|
|
RUN --mount=type=cache,target=/root/.npm \
|
|
npm ci
|
|
|
|
COPY . .
|
|
|
|
# Build-time version info — injected by docker-compose or CI via --build-arg.
|
|
ARG BUILD_VERSION=dev
|
|
ARG BUILD_COMMIT=unknown
|
|
ARG BUILD_TIME=unknown
|
|
|
|
# Expose as PUBLIC_ env vars so SvelteKit's $env/dynamic/public can read them.
|
|
ENV PUBLIC_BUILD_VERSION=$BUILD_VERSION
|
|
ENV PUBLIC_BUILD_COMMIT=$BUILD_COMMIT
|
|
ENV PUBLIC_BUILD_TIME=$BUILD_TIME
|
|
|
|
RUN npm run build
|
|
|
|
# ── Runtime image ──────────────────────────────────────────────────────────────
|
|
# adapter-node bundles most server-side code, but packages with dynamic
|
|
# requires or native bindings (e.g. ioredis) are not inlined by Rollup and
|
|
# must be present in node_modules at runtime. We install only production
|
|
# deps (no devDependencies) to keep the image small.
|
|
FROM node:22-alpine
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /app/build ./build
|
|
COPY --from=builder /app/package.json ./package.json
|
|
COPY --from=builder /app/package-lock.json ./package-lock.json
|
|
|
|
RUN --mount=type=cache,target=/root/.npm \
|
|
npm ci --omit=dev
|
|
|
|
ENV NODE_ENV=production
|
|
ENV PORT=3000
|
|
ENV HOST=0.0.0.0
|
|
|
|
# Carry build-time metadata into the runtime image so the UI footer can
|
|
# display the version, commit SHA, and build timestamp.
|
|
# These must be re-declared after the second FROM — ARG values do not
|
|
# cross stage boundaries, but ENV values set here persist at runtime.
|
|
ARG BUILD_VERSION=dev
|
|
ARG BUILD_COMMIT=unknown
|
|
ARG BUILD_TIME=unknown
|
|
ENV PUBLIC_BUILD_VERSION=$BUILD_VERSION
|
|
ENV PUBLIC_BUILD_COMMIT=$BUILD_COMMIT
|
|
ENV PUBLIC_BUILD_TIME=$BUILD_TIME
|
|
|
|
EXPOSE $PORT
|
|
CMD ["node", "build"]
|