mirror of
https://github.com/netbirdio/docs.git
synced 2026-08-24 16:51:26 +02:00
perf: build docs on the CI runner with a warm .next cache (#840)
Move `npm run build` out of the Docker image onto the runner, where actions/cache persists .next/cache across runs (the in-Docker build discarded it every time). The image now just packages the prebuilt .next and serves it with `next start`; runtime and the DocSearch entrypoint injection are unchanged. Also: checkout full history (fetch-depth: 0) so per-page dates are correct, guard buildGitDateMap against shallow clones (correct-or-absent, never wrong), modernise the Docker actions (build-push-action v6, provenance: false), and add a path-filtered pull_request trigger so pipeline changes are validated before merge. Smoke-tested via isolated build + docker run: serves /, /introduction, /api, sitemap, static assets (200); DocSearch placeholder injection intact.
This commit is contained in:
@@ -10,17 +10,16 @@ RUN npm install --global pm2
|
||||
# Utilise Docker cache to save re-installing dependencies if unchanged
|
||||
COPY ./package*.json ./
|
||||
|
||||
# Install dependencies (npm ci = clean, reproducible install from the lockfile)
|
||||
# Install runtime dependencies (npm ci = clean, reproducible install from the lockfile)
|
||||
RUN npm ci --omit=dev
|
||||
|
||||
# Copy all files
|
||||
# Copy the app, including the prebuilt .next output. The build now runs on the
|
||||
# CI runner (see .github/workflows/build_n_push.yml) with a warm .next/cache,
|
||||
# so there is no `npm run build` step here — we only package the result.
|
||||
COPY ./ ./
|
||||
|
||||
COPY /docker/entrypoint.sh ./entrypoint.sh
|
||||
|
||||
# Build app
|
||||
RUN npm run build
|
||||
|
||||
RUN chmod u+x /usr/app/entrypoint.sh
|
||||
|
||||
# Expose the listening port
|
||||
|
||||
Reference in New Issue
Block a user