Repository navigation
refactor(compose): dedupe bot+backend env vars via YAML anchor - #852
Conversation
The standalone `Dockerfile.frontend` re-ran `npm ci` for the entire workspace just to build the frontend SPA, which: 1. Wasted ~10-12s per build duplicating the dep install. 2. Exposed the frontend image build to the bot's native deps (@discordjs/opus). PR #846 hit this when Dependabot bumped to `node:26-alpine` — Alpine without a C toolchain couldn't build opus from source, breaking `docker-publish` for 4 days. This refactor merges frontend building into the main `Dockerfile` as two new stages: - `build-frontend` — inherits from existing `build` stage (which already has `build-base + python3-dev + opus-dev`), copies frontend source, runs `npm run build --workspace=packages/frontend`. Native compilation works here even if prebuilts are missing for the chosen Node major. - `production-frontend` — `nginxinc/nginx-unprivileged:1.27-alpine`, copies dist from `build-frontend`, serves on :8080, includes HEALTHCHECK. Wired through: - `docker-compose.yml` frontend service → `target: production-frontend` - `.github/workflows/docker-publish.yml` matrix entry updated - `docs/DOCKER.md` updated - `Dockerfile.frontend` deleted Overrides the 12-month defer on `docs/decisions/2026-05-13-frontend-dockerfile-keep-separate.md`. ADR update follows in a separate commit.
The 12-month-defer ADR was hedging against a hypothetical break. PR #846 already fired the hedge's trigger condition. Consolidating now: 5 files, ~30 LOC delta, no behavior change, eliminates the structural cause.
Bot and backend share ~25 env vars (NODE_ENV, DISCORD auth, Sentry stack,
DATABASE_URL, Redis config, last.fm, Spotify, webapp secrets). Previously
each service repeated the full list with identical `${VAR:-default}`
patterns.
Extracts `x-common-app-env: &common-app-env` as a top-level mapping;
both services consume it via `environment:\n <<: *common-app-env` +
service-specific overrides inline.
Trade: converts env from list-of-strings (`- KEY=value`) to mapping
(`KEY: value`). YAML merge keys (`<<:`) require mapping style. Compose
accepts both, no behavior change verified via `docker-compose config`.
LOC delta: docker-compose.yml shrinks ~7% (282→263). The real win is
that adding a new shared var now touches one place instead of two.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
LucasSantana-Dev has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.
|
Failed to generate code suggestions for PR |
|



Deduplicates shared environment variables between
botandbackendservices indocker-compose.ymlusing a YAML anchor (x-common-app-env).