Support a single docker image for deployments - #14362
Merged
Merged
Conversation
nothingrandom
requested review from
a team and
eviljeff
and removed request for
a team
July 30, 2026 15:39
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #14362 +/- ##
=======================================
Coverage 98.13% 98.13%
=======================================
Files 269 269
Lines 10750 10750
Branches 3314 3314
=======================================
Hits 10550 10550
Misses 187 187
Partials 13 13 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
eviljeff
approved these changes
Jul 31, 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.
Fixes mozilla/addons#2184
Summary
Moves the webpack production build out of container startup and into image build time. Today every app instance (and the static-upload job) starts with
npm run build && … npm start, and that webpack build takes 2 to 5 minutes per instance, which delays every pod start and every rollout.Env-specific values (
apiHost,baseURL,fxaConfig,extensionWorkshopUrl,langs, and so on) are baked into the client bundle via webpack'sDefinePlugin(CLIENT_CONFIG), so a single generic bundle can't serve every environment. The browser bundle is frozen at build time and can't be overridden by a runtime env var. So we build one bundle per env at image build time and select the right one at container start. This matches OPs' preference for a single generic image switched by one env var.Why
Runtime env-var overrides only rebind server config. The browser bundle (
src/amo/api/index.jscallsconfig.get('apiHost'), which resolves from the frozenCLIENT_CONFIGon the client) is fixed at build time. I verified locally that the per-env bundles differ: the stage bundle bakes inaddons.allizom.org, the prod bundle onlyaddons.mozilla.org. So per-env builds are required, not optional.Notes
static/. PR builds stay single-env, so PR turnaround is unaffected.npm run buildfrom the deployment command and the static-upload job. This image change is backward compatible on its own: the oldsh -c "npm run build && npm start"override still works against this image.Local validation / testing
Everything below was run locally against the npm layer. The Docker layer wraps these same commands.
1. Build two envs and confirm the bundles genuinely differ per env:
Expected:
amo-4f3f13b1...(containsaddons.allizom.org)amo-0ad27136...(containsaddons.mozilla.org)2. Boot with prebuilt STAGE assets, no build at start:
Expected:
apiHost:https://internal-api.addons.allizom.orgamo-4f3f13b1...3. Switch to PROD against the same artifacts, still no build:
Expected:
apiHost:https://internal-api.addons.mozilla.orgamo-0ad27136...4. (Optional) Docker end-to-end: