CI/CD Pipeline on Forgejo Actions with Docker & Dokploy Deployment #11
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What to build
Establish an automated CI/CD pipeline on Forgejo Actions targeting Dokploy. The pipeline validates code quality on Pull Requests and merges (
vp checkandpnpm build), builds a multi-stage standalone Docker image, publishes container tags to the Forgejo Container Registry (git.nokopia.com), triggers redeployment on Dokploy via webhook, and prunes stale commit tags to prevent registry bloat.Technical specifications
Target files:
next.config.ts: Enableoutput: "standalone"for minimal container footprint.Dockerfile: Multi-stagenode:22-alpinecontainer configuration..dockerignore: Docker build context exclusions (.git,node_modules,.next, scratch, docs)..forgejo/workflows/ci.yml: Reusable pull request and push quality verification workflow..forgejo/workflows/deploy.yml: Production container build, publish, Dokploy redeploy, and prune workflow..forgejo/scripts/prune-container-tags.mjs: Automated registry cleanup keeping 2 recent commit SHA tags.Container Image Architecture:
node:22-alpinewithcorepack enable pnpm.builder): Install dependencies viapnpm install --frozen-lockfile, compile Next.js standalone output viapnpm build, remove.next/cache.runner): Unprivileged system usernextjs:nodejs(UID 1001), port3000, bind0.0.0.0. Copy standalone server, static assets, and public directory.CI Workflow (
ci.yml):pull_request(targetmain),push(branches:[main]),workflow_dispatch,workflow_call.group: ci-${{ github.workflow }}-${{ github.ref }},cancel-in-progress: true.runs-on: ubuntu-latest, Node 22, pnpm, pnpm store cache viaactions/cache@v4.pnpm exec vp check(TypeScript + linter/formatter) andpnpm build.CD Workflow (
deploy.yml):pushtomain,workflow_dispatch.ci.ymlcompletion.git.nokopia.com/${{ github.repository }}:latestand:${{ github.sha }}.git.nokopia.com/${{ github.repository }}:buildcache(mode=max).X-Gitea-Event: pushand payload{"ref":"${{ github.ref }}"}to avoid branch mismatch errors. Gracefully skips ifDOKPLOY_DEPLOY_URLsecret is not configured.prune-container-tags.mjswithKEEP=2to ensure VPS disk capacity is safeguarded.Secrets required
CONTAINER_REGISTRY_TOKEN: Package read/write token forgit.nokopia.com.DOKPLOY_DEPLOY_URL: (Optional initially) Webhook URL generated by Dokploy application.Acceptance criteria
next.config.tsconfigured withoutput: "standalone".Dockerfilebuilds cleanly without warnings and runs as unprivileged user.vp checkandpnpm buildon Forgejo Actions runner.mainbuilds container image and pushes togit.nokopia.com/yuris/titik-gambut-next.:latestand:buildcache.Blocked by
None - High Priority (Priority 0 gatekeeper for ongoing vertical slices).
Issue 10: CI/CD Pipeline on Forgejo Actions with Docker & Dokploy Deploymentto CI/CD Pipeline on Forgejo Actions with Docker & Dokploy Deployment