Add CapRover PR preview deployment - #136
Open
asyncawaitpromise wants to merge 1 commit into
Open
Conversation
Self-contained multi-stage Dockerfile (builds the static export inside the image itself, rather than expecting a host-built out/ dir) so the same Dockerfile works for both caprover deploy/tarball testing and CI. Includes scripts/deploy-tar.sh and scripts/scaffold.sh for fast local iteration against a CapRover server with no CI/registry round-trip, plus GitHub Actions workflows for per-PR preview deploys (PR comment with the preview URL) and cron-based cleanup of expired previews. Verified end-to-end against a live CapRover instance: caprover deploy built and served the site correctly (home, static routes, dynamic event pages, 404s, static assets). Supersedes #104 and #106.
This was referenced Aug 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds CapRover-based PR preview deployments, replacing the approach in #104/#106.
Dockerfile— builds the Next.js static export inside the image, rather than expecting a host-builtout/(which is gitignored, socaprover deploy/tarball builds against PR Preview feature for CapRover #104's Dockerfile would never have worked).captain-definition+scripts/deploy-tar.sh/scripts/scaffold.sh— lets anyone with CapRover CLI access iterate locally (deploy in ~90s) with no CI or container registry needed..github/workflows/preview.yml— per-PR ephemeral CapRover app, builds+pushes to GHCR, comments the preview URL on the PR, tears down on close..github/workflows/cleanup-previews.yml— cron sweep that expires inactive previews after 6h.nginx.conf— fixes a routing gap where extensionless static-export routes (e.g./events→events.html) 403 under default nginx config.Verified end-to-end against a live CapRover server:
caprover deploybuilt and served the site correctly (home, static routes, dynamic event detail pages, 404s, static assets all returned correct status codes).Why this instead of #104
#104's Dockerfile assumed a pre-built
out/in the build context, which is gitignored — so it only worked via the CI path (build on runner → push image → CapRover pulls it), with no way to test locally without a full CI round-trip. This PR's Dockerfile builds from source inside Docker, so the exact same Dockerfile works for instant local iteration (caprover deploy) and for CI.Secrets required (repo Settings → Secrets and variables → Actions)
CAPROVER_URLCAPROVER_PASSWORDCAPROVER_APP_DOMAINNEXT_PUBLIC_SUPABASE_URL/NEXT_PUBLIC_SUPABASE_ANON_KEYare already present and public (baked into the Dockerfile as fallback defaults too, matching check.yml).Test plan
docker buildsucceeds locally_next/static) — all verified withcurlcaprover deploy(tarball) to a live CapRover server succeeds and the deployed app serves the same routes correctly over HTTPSpreview.yml/cleanup-previews.ymlcan run in CI