diff --git a/docs/guides/self-hosting.md b/docs/guides/self-hosting.md index 5750266ae7..8fd082c281 100644 --- a/docs/guides/self-hosting.md +++ b/docs/guides/self-hosting.md @@ -50,16 +50,22 @@ node_modules Add this `Dockerfile`: ```dockerfile -FROM denoland/deno:2.6.0 +FROM node:22-slim WORKDIR /app +COPY package.json package-lock.json ./ +RUN npm ci COPY . . -RUN deno task build +RUN npm run build EXPOSE 3000 -CMD ["deno", "task", "start"] +CMD ["npm", "start"] ``` +`npm ci` installs the project-local Veryfront CLI from the lockfile before the +image builds the app. Copying the package files first also lets Docker reuse the +dependency layer when only application code changes. + Build and run it: ```bash diff --git a/tests/docs/guide-code-examples.test.ts b/tests/docs/guide-code-examples.test.ts index 061c1ed060..a0d4d4b482 100644 --- a/tests/docs/guide-code-examples.test.ts +++ b/tests/docs/guide-code-examples.test.ts @@ -1087,6 +1087,11 @@ describe("Guide: self-hosting.md", () => { const command of [ "veryfront build", "veryfront serve", + "FROM node:22-slim", + "COPY package.json package-lock.json ./", + "RUN npm ci", + "RUN npm run build", + 'CMD ["npm", "start"]', "docker build -t veryfront-app .", "docker run --rm -p 3000:3000 --env-file .env veryfront-app", ] @@ -1094,6 +1099,7 @@ describe("Guide: self-hosting.md", () => { assertStringIncludes(guide, command); } assertEquals(guide.includes("veryfront login"), false); + assertEquals(guide.includes("FROM denoland/deno"), false); }); });