The Gitea runner hung for over 30 minutes on `npm ci` because it cannot reach registry.npmjs.org. The registry is now configurable through the NPM_REGISTRY repository variable, passed on to the server's Docker build, and npm gives up after bounded retries. Jobs also have time limits (test 15 min, deploy 30 min) so the runner is never held forever. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16 lines
658 B
Docker
16 lines
658 B
Docker
# Stage 1: run the tests and build the static game with Vite.
|
|
FROM node:22-alpine AS build
|
|
WORKDIR /app
|
|
# Override with a reachable mirror where registry.npmjs.org is blocked (docker compose passes NPM_REGISTRY).
|
|
ARG NPM_REGISTRY=https://registry.npmjs.org/
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci --no-audit --no-fund --registry="$NPM_REGISTRY" --fetch-retries=3 --fetch-timeout=60000
|
|
COPY . .
|
|
RUN node --test tests/*.test.js && npm run build
|
|
|
|
# Stage 2: serve dist/ with Caddy, which also obtains and renews the HTTPS certificate.
|
|
FROM caddy:2.8.4-alpine
|
|
COPY Caddyfile /etc/caddy/Caddyfile
|
|
COPY --from=build /app/dist /srv
|
|
EXPOSE 80 443 443/udp
|