Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions docs/guides/self-hosting.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Run the server as the container's signal-receiving process

When an orchestrator stops or replaces this container, Docker sends SIGTERM to PID 1, which here is npm rather than Veryfront. npm start launches the package script as a child and does not forward SIGTERM, so the handler in cli/commands/serve/command.ts never drains tracked requests or flushes telemetry before the container exits. Use an entrypoint that execs the actual server process, or explicitly forwards and reaps signals, so this production recipe shuts down cleanly.

AGENTS.md reference: AGENTS.md:L57-L57

Useful? React with 👍 / 👎.

```

`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
Expand Down
6 changes: 6 additions & 0 deletions tests/docs/guide-code-examples.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1087,13 +1087,19 @@ 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",
]
) {
assertStringIncludes(guide, command);
}
assertEquals(guide.includes("veryfront login"), false);
assertEquals(guide.includes("FROM denoland/deno"), false);
});
});

Expand Down