Migrate charterafrica builds to Docker Bake - #1511
Open
kelvinkipruto wants to merge 2 commits into
Open
Conversation
Matches the naming already used by roboshield/trustlab/climatemappedafrica.
Adds docker/apps/charterafrica/Dockerfile and a bake target following the climatemappedafrica/pesayetu/roboshield/trustlab pattern: turbo-prune based multi-stage build, secrets mounted via BuildKit instead of build args, and CI wired through the shared _bake-and-push.yml reusable workflow. charterafrica has no real Dokku app for either DEV or PROD yet (the pre-bake workflows never actually deployed), so deploy-dev/deploy-prod are added with if: false placeholders, matching the unresolved TODOs already present in the legacy workflows.
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.
Description
Migrate
charterafricafrom the legacy shared rootDockerfileto the repository's per-app Dockerfile and Docker Bake build architecture, following the same pattern already established forclimatemappedafrica/pesayetu/roboshield/techlabblog/trustlab.Why
Docker builds against the legacy shared
Dockerfileare slow and have repeatedly broken in ways unrelated to the app itself (see #1507, #1509). Movingcharterafricaonto the turbo-prune-based Bake architecture keeps its build isolated, cacheable, and consistent with the other migrated apps.charterafricauses a custom Express + Payload server (server.ts, compiled todist/server.js) that connects to MongoDB viapayload.init()beforenext buildruns, so — likeclimatemappedafrica— this build genuinely needs a reachable database, not just a well-formed connection string.Neither of
charterafrica's pre-bake deploy workflows (charterafrica-deploy-dev.yml,charterafrica-deploy-prod.yml) actually pushes to a real Dokku app today: DEV has no deploy step at all, and PROD's is gated behind an unresolvedif: falseTODO about which server to target. This migration preserves that exact state — it only replaces how the image is built, not what happens to it afterward.What changed
charterafrica Docker Bake migration
docker/apps/charterafrica/Dockerfile. Likeclimatemappedafrica, this app doesn't use Next.jsoutput: "standalone", so the runner stage copies the fullnode_modules/.nextfolder rather than a pruned standalone bundle, plus the app's ownmigrations/,scripts/, andapp.json(Dokku cron config, not healthchecks —charterafricaruns scheduled jobs viascripts/ecosystem.mjs).charterafricatarget todocker-bake.hcland the sharedappsgroup, inheriting_app-runner. Unlike the Payload apps that inherit_payload-app-runner,charterafricadeclares its own secret list, since its server readsPAYLOAD_SECRET_KEY(notPAYLOAD_SECRET).DATABASE_URLfor the Payload DB connection instead ofMONGO_URL, matchingroboshield/trustlab/climatemappedafrica, acrosspayload.config.ts,migrate-mongo-config.js,turbo.json, and.env.template.ui-builder-base/ui-runner-baseimages in CI.make charterafricaand Compose usage to the Bake-built image.charterafricamigrated indocker/README.md.Dockerfilestage untouched for now, matching the rollback-safety precedent from the other migrations.CI/CD
_build-charterafrica.yml) and a new orchestration workflow (charterafrica.yml): build + push to DockerHub on every push to DEV (there's no DEV Dokku app to deploy to), and build on PROD version bump —deploy-dev/deploy-prodare added withif: falseplaceholders, mirroring the same unresolved TODOs already present in the legacy workflows this replaces.charterafricato thepr-build.ymlimage-validation workflow andscripts/pr-build-targets.mjs's target detection. PR builds use the realCHARTERAFRICA_MONGO_URLsecret (mapped toDATABASE_URL) rather than a dummy value, since the build needs a reachable database to succeed.CHARTERAFRICA_MONGO_URL/CHARTERAFRICA_PAYLOAD_SECRET_KEY/CHARTERAFRICA_SENTRY_DSN/CHARTERAFRICA_SENTRY_PROJECTcarry over, just remapped to the Bake secret names.Validation
docker buildx bake charterafricaagainst a real local MongoDB instance — fullturbo prune→ install →next build(compile, lint, static export) →payload buildall pass.docker runsmoke test — the built image boots, Payload connects, Next.js starts, and/adminreturns HTTP 200.pnpm test:scripts— allpr-build-targetsdetection tests pass, including the updatedcharterafricacases.Type of change
Screenshots
N/A
Checklist