Cloudrive

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 context apps/api:
    docker build -f apps/api/deploy/Dockerfile -t cloudrive-api apps/api
  • Web UI (apps/web-ui/deploy/Dockerfile) — build context repo root (needs packages/shared and bun.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 via bun run deploy:main.
  • Docs (apps/docs) — deployed to Cloudflare Workers via bun run deploy:docs.
ServiceRuntime
apps/apigcr.io/distroless/static-debian12:nonroot: static api + migrate binaries (embedded SQL), templates
apps/web-uinginxinc/nginx-unprivileged:1.29-alpine on port 3000 serving the Vite SPA
apps/main-webCloudflare Workers (vinext + @vinext/cloudflare)
apps/docsCloudflare 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-api
  • entrypoint.sh maps each non-empty environment variable to its flag, appended after the image defaults (--env=production --port=8080). No .env is 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 /health every 30 seconds.
  • Set WEB_URL to the public web UI origin and AUTH_BASE_URL to the public API origin, and add WEB_URL to CORS_ALLOWED_ORIGINS so Authula accepts its redirect_to / callback_url.
  • Behind a reverse proxy, set TRUSTED_PROXIES so logs and rate limiting see real client IPs. The client IP is the rightmost X-Forwarded-For entry 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=false and 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:

  1. Release Prepare (release-prepare.yml, run manually on main): bumps the version (auto from the commits since the last v* tag, or patch/minor/major), updates CHANGELOG.md, syncs every apps/*/package.json version (scripts/sync-versions.mjs), and opens a chore: release vX.Y.Z pull request.
  2. Release Publish (release-publish.yml): when that release/* PR merges into main, tags the merge commit and creates the GitHub release, then dispatches the release workflow.
  3. Release (release.yml): builds and pushes both images to GHCR. It also runs on a pushed vX.Y.Z tag, or manually with an extra tag.
ImageDockerfile
ghcr.io/<owner>/cloudrive/apiapps/api/deploy/Dockerfile
ghcr.io/<owner>/cloudrive/webapps/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)

On this page