OrbitDocs packages are coming to npm soon. Until then, run it from the GitHub repo →
Deploy

Docker

Package the static docs build as a small nginx image with one command.

orbitdocs deploy --target docker builds the site and writes a Dockerfile and an nginx.conf that serve it. You get an image that runs anywhere containers run: Kubernetes, ECS, Fly.io, Cloud Run or a single VM.

Build the image

Generate the files in the docs app folder:

npx orbitdocs deploy --target docker

This runs orbitdocs build, then writes Dockerfile and nginx.conf next to orbitdocs.config.ts.

Keep the build context small (optional but faster):

docs/.dockerignore
node_modules
.next

Build and run:

docker build -t acme-docs docs
docker run -p 8080:80 acme-docs

Open http://localhost:8080/ (or http://localhost:8080/docs/ with a base path).

What gets written

docs/Dockerfile
FROM nginx:1.29-alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY out/ /usr/share/nginx/html/
EXPOSE 80
docs/nginx.conf
server {
  listen 80;
  root /usr/share/nginx/html;
  location / {
    try_files $uri $uri/ $uri.html =404;
  }
  error_page 404 /404.html;
}

With output.basePath: '/docs', the location becomes /docs with an alias to the same folder, and the error page becomes /docs/404.html.

Your edits are kept

The files are written only when the docs app has no Dockerfile yet. Once it exists, the command just builds the site and prints the docker build line, so you can edit both files freely. Changing basePath later? Update nginx.conf by hand, or delete both files and run the command again.

Rebuild on every release

The image copies out/, so rebuild the site before each image build:

cd docs
npx orbitdocs deploy --target docker   # rebuilds out/
docker build -t registry.acme.com/acme-docs:1.4.0 .
docker push registry.acme.com/acme-docs:1.4.0

--skip-build reuses the current out/ when you only changed the image.

Limits

  • Static only. The command needs output.mode: 'static'. For a container that runs private docs or Ask AI, see Run it in a container on the server mode page.
  • No private docs, no Ask AI. nginx serves every file to everyone. The build warns when the config has access.
  • Redirects without * work (they are HTML pages). nginx ignores _redirects, so add rewrite rules to nginx.conf for wildcard redirects.

Looking for the image of the self-hosted platform? That is a different image, built from apps/platform/Dockerfile. See Install the platform.

Next steps

Last updated on

On this page