fix: harden Docker builds for Coolify production deployments#9
Merged
Conversation
- Upgrade base images from node:18-slim to node:22-slim (Angular 21 + NX 22 require Node 20+) - Add HUSKY=0 to prevent husky prepare script from failing in Docker (no .git in build context) - Add NODE_OPTIONS max-old-space-size=3072 to prevent Angular OOM during build - Fix back runtime image to use node:22-slim (Debian) instead of Alpine to support native modules (bcrypt, pdf2pic) - Switch from npm install --omit=dev in dist to npm prune --omit=dev in workspace root, then copy node_modules — avoids NX lockfile conflict in dist - Fix nginx/default.conf placeholder: replace YOUR_BACK_DOMAIN_HERE with http://back:3200 - Add .dockerignore to exclude node_modules, dist, .git, .env from Docker build context - Add environment.prod.ts fallback in front Dockerfile (copies example if prod file absent) - Fix environment.prod.example.ts: use correct 'env' export name and relative /api/v1/ path - Remove .dockerignore from .gitignore so it is tracked by git Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Without ports, Coolify/Traefik cannot route traffic to the frontend. Also adds front to back-starter-network so nginx can proxy to back. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
9 tasks
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.
Summary
Applies all fixes discovered during the first real Coolify deployment of a project based on this starter. Every issue blocked the Docker build or prevented Traefik from routing traffic to the frontend.
HUSKY=0beforenpm install— thepreparelifecycle script fails in Docker because.gitis excluded from the build contextNODE_OPTIONS=--max-old-space-size=3072— prevents Angular OOM during production buildnode:22-slim(Debian) instead of Alpine — native modules (bcrypt, pdf2pic) compile for glibc and can't run on Alpine's musl libcnpm prune --omit=devinstead ofnpm install --omit=devin dist — NXgeneratePackageJson: truecopies the full workspacepackage-lock.jsonto dist, which conflicts with a fresh install; pruning the workspacenode_modulesand copying them avoids the conflictnginx/default.confplaceholder fixed — replacedYOUR_BACK_DOMAIN_HEREwithhttp://back:3200.dockerignoreadded — excludesnode_modules,dist,.git,.envfrom build context; removed.dockerignorefrom.gitignoreso it is trackedenvironment.prod.example.tsfixed — wrong variable name (environment→env) and absolute URL replaced with relative/api/v1/environment.prod.tsis absent so the build works out of the boxcompose.yaml:ports+networkfor front service — without aportsentry Coolify/Traefik has no port to proxy to for the domainTest plan
docker compose buildsucceeds locallydocker compose upbrings up all three services🤖 Generated with Claude Code