Overview
docmd ships with a dedicated @docmd/deployer package. It reads your docmd.config.json and generates provider-specific deployment files automatically. Every generated file is personalised to your exact configuration - your output directory, site URL, SPA routing rules, and Node.js version are all reflected without manual editing.
Supported Providers
| Provider | Command Flag | Files Generated |
|---|---|---|
| Docker + Nginx | --docker |
Dockerfile, .dockerignore |
| Nginx | --nginx |
nginx.conf |
| Caddy | --caddy |
Caddyfile |
| GitHub Pages | --github-pages |
.github/workflows/deploy.yml |
| Vercel | --vercel |
vercel.json |
| Netlify | --netlify |
netlify.toml |
Usage
Run from your project root (where docmd.config.json lives):
# Single provider
npx @docmd/core deploy --github-pages
# Multiple providers at once
npx @docmd/core deploy --docker --nginx
# Overwrite existing files
npx @docmd/core deploy --vercel --force
Provider Details
GitHub Pages
npx @docmd/core deploy --github-pages
Generates .github/workflows/deploy.yml with a complete build-and-deploy pipeline. The workflow:
- Checks out your repository
- Installs Node.js (matching your project’s required version)
- Runs
npx @docmd/core build - Uploads the output directory to GitHub Pages
Vercel
npx @docmd/core deploy --vercel
Generates vercel.json with SPA routing rules (rewrites all paths to index.html) and your configured output directory.
Netlify
npx @docmd/core deploy --netlify
Generates netlify.toml with your build command, publish directory, and SPA redirect rules.
Docker
npx @docmd/core deploy --docker
Generates a Dockerfile using a multi-stage build:
- Build stage: Installs your exact pinned
@docmd/coreversion and runs the build. - Serve stage: Copies output into a minimal
nginx:alpineimage.
If an nginx.conf already exists in your project root, the Dockerfile automatically copies it into the container.
# Generate Docker and Nginx configs together
npx @docmd/core deploy --docker --nginx
Nginx
npx @docmd/core deploy --nginx
Generates nginx.conf with SPA routing, gzip compression, and correct root path for your output directory.
Caddy
npx @docmd/core deploy --caddy
Generates a Caddyfile with automatic HTTPS, SPA routing, and file serving from your output directory.
Re-Generating
Changed your config? Re-run the same deploy command. Use --force to overwrite existing files:
npx @docmd/core deploy --docker --force
Trade-offs
Generated configs are opinionated starting points. They are correct for the majority of docmd deployments but may require adjustments for advanced scenarios such as custom domains, CDN rewrites, or multi-region deployments. Always review generated files before deploying to production.