Skip to content

feat: add Dockerfile for self-hosting#40

Open
elio-Wang wants to merge 1 commit into
antfu:mainfrom
elio-Wang:feat/docker
Open

feat: add Dockerfile for self-hosting#40
elio-Wang wants to merge 1 commit into
antfu:mainfrom
elio-Wang:feat/docker

Conversation

@elio-Wang

Copy link
Copy Markdown
  • Add multi-stage Dockerfile (node-server preset)
  • Add .dockerignore
  • Allow overriding git revision and Nitro preset via env vars
  • Document Docker usage in README

Closes #19

🔗 Linked issue

resolves #19

🔄 Context

Currently the server is hardcoded to the netlify_edge preset with no official way to self-host. Users who want to deploy on their own infrastructure need a Docker image.

📚 Description

Add a multi-stage Dockerfile that builds the server with the node-server Nitro preset, producing a minimal production image containing only Node.js and the compiled .output directory.

Changes:

  • Dockerfile: 3-stage build (deps → build → runtime), final image based on node:22-slim
  • .dockerignore: exclude node_modules, .git, .output, etc.
  • server/nitro.config.ts: allow NITRO_PRESET and GIT_REVISION env var overrides, with try-catch fallback for git rev-parse in environments without .git
  • README.md: add Docker build & run instructions with environment variable reference

- Add multi-stage Dockerfile (node-server preset)
- Add .dockerignore
- Allow overriding git revision and Nitro preset via env vars
- Document Docker usage in README

Closes antfu#19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Docker container solution

1 participant