From 3a0f93c5808cc6578d51d82ed3c3a4bcc0ef3bed Mon Sep 17 00:00:00 2001 From: Eric Sandu Date: Sun, 3 May 2026 14:43:59 +0300 Subject: [PATCH 1/3] fix(docker): Update Dockerfile to prevent shadowing of search-meta Generate search-meta directly at runtime in the mounted volume. Signed-off-by: Eric Sandu --- Dockerfile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 51cbf889..67ac55d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,11 +11,15 @@ WORKDIR /docs ENV NODE_ENV=development ENV NEXT_TELEMETRY_DISABLED=1 -COPY . . +# Install dependencies separately to leverage Docker cache +COPY package.json package-lock.json ./ +RUN npm install --ignore-scripts -RUN npm install +# Copy source code +COPY . . -CMD ["npm", "run", "dev"] +# Generate search-meta at runtime so it populates the mounted volume, then start dev +CMD ["sh", "-c", "npm run search-meta:gen && npm run dev"] # Rebuild the source code only when needed FROM dev AS builder From a8a9a83d0546d7b5c89350f5dfb6d0cf555db17d Mon Sep 17 00:00:00 2001 From: Eric Sandu Date: Sun, 3 May 2026 14:45:10 +0300 Subject: [PATCH 2/3] fix(docs): Update README.md docker instructions to prevent shadowing Specifies node_modules location on the container to prevent shadowing with the local one. Signed-off-by: Eric Sandu --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d211cbde..02434020 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ It is deployed on the [Unikraft website](https://unikraft.org/) It provides information for the latest version of [Unikraft](https://github.com/unikraft/unikraft) and [KraftKit](https://kraftkit.sh). Documentation is written in [MDX](https://mdxjs.com/) format. -Building and deploying it requires Node and NPM. +Building and deploying it requires Node and npm. You can build and run either natively or using Docker. ## Building and Testing Natively @@ -29,7 +29,7 @@ For local development: ```console docker build -t ghcr.io/unikraft/docs:dev --target dev . -docker run -it --rm -v $(pwd):/docs -w /docs -p 3000:3000 ghcr.io/unikraft/docs:dev +docker run -it --rm -v $(pwd):/docs -v unikraft_modules:/docs/node_modules -w /docs -p 3000:3000 ghcr.io/unikraft/docs:dev ``` For production deployment: From 8a5c8dfa861c254840f34ad5daf68c5d29f92ac3 Mon Sep 17 00:00:00 2001 From: Eric Sandu Date: Sun, 3 May 2026 22:43:57 +0300 Subject: [PATCH 3/3] fix(docker): Update Dockerfile to fix compilation on Alpine Adds necessary packages for Alpine and bypasses postinstall script during dependency installation. Signed-off-by: Eric Sandu --- Dockerfile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 67ac55d2..e7895887 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,8 +3,10 @@ FROM node:20-alpine AS base # Install dependencies only when needed FROM base AS dev # Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. - -RUN apk add --no-cache libc6-compat +# libc6-compat & gcompat are needed for native modules (e.g. esbuild) on alpine. +# openssl is required for HTTPS requests (Octokit). +# git is required for husky, lint-staged, and metadata scripts. +RUN apk add --no-cache libc6-compat gcompat openssl git WORKDIR /docs @@ -13,7 +15,8 @@ ENV NEXT_TELEMETRY_DISABLED=1 # Install dependencies separately to leverage Docker cache COPY package.json package-lock.json ./ -RUN npm install --ignore-scripts +# Bypass postinstall since it requires source code which isn't copied yet +RUN npm pkg delete scripts.postinstall && npm install # Copy source code COPY . . @@ -45,6 +48,7 @@ ENV NODE_ENV=production ENV NEXT_TELEMETRY_DISABLED=1 RUN set -xe; \ + apk add --no-cache openssl; \ addgroup --system --gid 1001 nodejs; \ adduser --system --uid 1001 nextjs