brackt/Dockerfile
Chris Parsons 2c4575c693
Some checks failed
🚀 Deploy / 🧪 Test (pull_request) Successful in 11m40s
🚀 Deploy / ʦ TypeScript (pull_request) Successful in 10m35s
🚀 Deploy / 🐳 Build (pull_request) Has been cancelled
🚀 Deploy / 🚀 Deploy (pull_request) Has been cancelled
🚀 Deploy / 🔍 Lint (pull_request) Has been cancelled
Optimize CI build pipeline and harden .npmrc handling
- Fix Dockerfile dev-deps layer cache invalidation: copy only package manifests
  before npm ci so the layer is reused on code-only commits
- Skip QEMU by pinning platforms: linux/amd64 in build-push-action (~4 min saving)
- Replace manual actions/cache blocks with actions/setup-node cache: npm in
  test/typecheck/lint jobs (removes 3 duplicate 8-line blocks, pins Node 20)
- Pass .npmrc as a Docker BuildKit secret (--mount=type=secret) instead of
  COPYing it, so it can never leak into registry build-cache layers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 20:40:35 -07:00

26 lines
No EOL
879 B
Docker

FROM node:20-alpine AS development-dependencies-env
COPY package.json package-lock.json /app/
WORKDIR /app
RUN --mount=type=secret,id=npmrc,target=/app/.npmrc npm ci
FROM node:20-alpine AS production-dependencies-env
COPY ./package.json package-lock.json /app/
WORKDIR /app
RUN --mount=type=secret,id=npmrc,target=/app/.npmrc npm ci --omit=dev
FROM node:20-alpine AS build-env
COPY . /app/
COPY --from=development-dependencies-env /app/node_modules /app/node_modules
WORKDIR /app
RUN npm run build
FROM node:20-alpine
COPY ./package.json package-lock.json /app/
COPY --from=production-dependencies-env /app/node_modules /app/node_modules
COPY --from=build-env /app/build /app/build
COPY --from=build-env /app/dist /app/dist
COPY ./drizzle /app/drizzle
COPY ./scripts /app/scripts
COPY ./instrument.server.mjs /app/instrument.server.mjs
WORKDIR /app
CMD ["npm", "run", "start"]