Deployment
Independent Docker images for API and dashboard SPA, plus Cloudflare Workers for the marketing site and docs.
The images
Container services build their own images, while marketing and docs deploy to Cloudflare Workers:
- API (
apps/api/deploy/Dockerfile) — build contextapps/api:docker build -f apps/api/deploy/Dockerfile -t cloudrive-api apps/api - Web UI (
apps/web-ui/deploy/Dockerfile) — build context repo root (needspackages/sharedandbun.lock):docker build -f apps/web-ui/deploy/Dockerfile --build-arg VITE_API_URL=https://api.cloudrive.us.ci -t cloudrive-web . - Main Web (
apps/main-web) — deployed to Cloudflare Workers viabun run deploy:main. - Docs (
apps/docs) — deployed to Cloudflare Workers viabun run deploy:docs.
| Service | Runtime |
|---|---|
apps/api | gcr.io/distroless/static-debian12:nonroot: static api + migrate binaries (embedded SQL), templates |
apps/web-ui | nginxinc/nginx-unprivileged:1.29-alpine on port 3000 serving the Vite SPA |
apps/main-web | Cloudflare Workers (vinext + @vinext/cloudflare) |
apps/docs | Cloudflare Workers (Fumadocs + TanStack Start + @cloudflare/vite-plugin) |
The build context is filtered by the root .dockerignore, shared with the docs image: no
node_modules, build output, or .env files.
The image's go build sets GOARCH=amd64. It runs on arm64 hosts only through emulation.
Running it
docker run -p 8080:8080 -p 9000:9000 \
-e MACHINE_ID=1 -e APP_SECRET=… -e DB_DSN=… \
-e WEB_URL=https://app.cloudrive.example.com -e AUTH_BASE_URL=https://api.cloudrive.example.com \
-e RESEND_API_KEY=… -e RESEND_FROM_EMAIL=… -e RESEND_DEBUG_TO_EMAIL=… \
-e STORAGE_CREDENTIALS_KEYS=v1:<base64-32-byte-key> \
-e MIGRATE_ON_BOOT=true -e SEED_ON_BOOT=true -e SUPER_USER=admin@example.com:changeme123 \
cloudrive-apientrypoint.shmaps each non-empty environment variable to its flag, appended after the image defaults (--env=production --port=8080). No.envis baked into the image.- Port 8080 serves the web app, the REST API and
/health; port 9000 is the S3 gateway. - The healthcheck polls
GET /healthevery 30 seconds. - Set
WEB_URLto the public web UI origin andAUTH_BASE_URLto the public API origin, and addWEB_URLtoCORS_ALLOWED_ORIGINSso Authula accepts itsredirect_to/callback_url. - Behind a reverse proxy, set
TRUSTED_PROXIESso logs and rate limiting see real client IPs. The client IP is the rightmostX-Forwarded-Forentry that is not a trusted proxy, so list every hop: behind Cloudflare, add its IP ranges too, or every request appears to come from a Cloudflare edge address. - Running more than one replica: keep
MIGRATE_ON_BOOT=falseand run migrations as a separate step:docker run --rm --entrypoint /app/migrate cloudrive-api --db-dsn=… up.
Release
Releases follow release-it with conventional commits, in three workflows:
- Release Prepare (
release-prepare.yml, run manually onmain): bumps the version (autofrom the commits since the lastv*tag, orpatch/minor/major), updatesCHANGELOG.md, syncs everyapps/*/package.jsonversion (scripts/sync-versions.mjs), and opens achore: release vX.Y.Zpull request. - Release Publish (
release-publish.yml): when thatrelease/*PR merges intomain, tags the merge commit and creates the GitHub release, then dispatches the release workflow. - Release (
release.yml): builds and pushes both images to GHCR. It also runs on a pushedvX.Y.Ztag, or manually with an extra tag.
| Image | Dockerfile |
|---|---|
ghcr.io/<owner>/cloudrive/api | apps/api/deploy/Dockerfile |
ghcr.io/<owner>/cloudrive/web | apps/web-ui/deploy/Dockerfile |
Tags per release: 1.2.3, v1.2, latest, and sha-<short>.
Preview the next version locally with bun run release:prepare --dry-run.
Repository setting
Release Prepare opens its PR with GITHUB_TOKEN: enable Settings → Actions → General → Allow
GitHub Actions to create and approve pull requests.
Docs site
apps/docs is built with Fumadocs + TanStack Start and deployed to Cloudflare Workers (docs.cloudrive.us.ci):
bun run dev:docs # http://localhost:3001
bun run build:docs # prerender + Workers bundle
bun run deploy:docs # deploy to Cloudflare Workers (needs CLOUDFLARE_API_TOKEN + CLOUDFLARE_ACCOUNT_ID)