This folder is a reusable deployment template based on your current build method:
- Push to
main - GitHub Actions builds Docker image
- Image is pushed to
ghcr.io - GitHub Actions calls Coolify webhook
- Coolify pulls latest image and redeploys
It is designed for:
- Next.js apps
- Payload + Next.js apps
template/.github/workflows/deploy-next-coolify.ymltemplate/.github/workflows/deploy-payload-coolify.ymltemplate/docker/Dockerfile.nexttemplate/docker/Dockerfile.payload-nexttemplate/docker-compose.mongo.ymltemplate/env/.env.coolify.exampletemplate/docs/current-build-flow.md
For a plain Next.js app:
- Copy
template/.github/workflows/deploy-next-coolify.ymlto.github/workflows/deploy.yml - Copy
template/docker/Dockerfile.nexttoDockerfile
For Payload + Next.js:
- Copy
template/.github/workflows/deploy-payload-coolify.ymlto.github/workflows/deploy.yml - Copy
template/docker/Dockerfile.payload-nexttoDockerfile
Optional local DB for Payload development:
- Copy
template/docker-compose.mongo.ymltodocker-compose.yml
For Next.js and Payload+Next.js:
- Set
output: 'standalone'innext.config.jsornext.config.ts - Ensure build command outputs
.next/standalone
Go to: Settings -> Secrets and variables -> Actions
Required for all apps:
COOLIFY_WEBHOOK_URLCOOLIFY_WEBHOOK_TOKEN
Required for Payload workflow template:
PAYLOAD_SECRETMONGODB_URI
If your app has additional build-time secrets, add them and pass them in workflow build-args.
Create a Coolify app/service that deploys from GHCR image.
Recommended setup:
- Image:
ghcr.io/<owner>/<repo>:latest - Exposed port:
3000 - Health check path:
/(or project specific) - Runtime env vars: add values from
template/env/.env.coolify.exampleas needed
If image is private:
- Configure GHCR credentials in Coolify with a token that can read packages.
A successful run will:
- Build and push image tags:
latest- commit SHA
- Trigger Coolify webhook
- Start new deploy in Coolify
- Some Payload setups require build-time access to:
PAYLOAD_SECRETMONGODB_URI
- Keep runtime secrets in Coolify as well.
- Most projects do not need build args in CI.
- Runtime-only secrets should stay in Coolify env vars.
- Keep auto deploy on
main - Keep immutable SHA tags for rollback
- In incidents, redeploy older SHA tag from Coolify
Image builds but app crashes in Coolify:
- Check missing runtime env vars first.
- Confirm app listens on
0.0.0.0:3000(or configured port).
Webhook step fails:
- Validate
COOLIFY_WEBHOOK_URLandCOOLIFY_WEBHOOK_TOKEN.
GHCR push denied:
- Ensure workflow permissions include
packages: write.
Standalone files missing:
- Ensure
output: 'standalone'is set.
- This template is additive and does not alter your existing repo files.
- For a deeper explanation of your current pipeline, see:
template/docs/current-build-flow.md