fix: incremental build FROM last good image, skipping yarn install entirely

This commit is contained in:
2026-06-14 18:22:54 -06:00
parent 2cb0b82ee1
commit 1a2b6b914a
+6 -23
View File
@@ -1,35 +1,18 @@
# ── Stage 1: install dependencies (cached base layer) ──────────────────────────
# Rebuild from node:20 only when yarn.lock or .yarnrc.yml changes; otherwise
# Docker reuses the layer. HUSKY=0 skips git-hook setup (no .git in build ctx).
FROM node:20 AS deps
# ── Incremental build: reuse installed deps from the last good image ────────────
# Only next build runs — no yarn install needed. When dependencies genuinely
# change, rebuild from node:20 using the full-install Dockerfile below.
ARG BASE_IMAGE=10.0.3.6:4000/zachariahsharma/vynte-scheduler:latest
FROM ${BASE_IMAGE}
WORKDIR /calcom
ARG MAX_OLD_SPACE_SIZE=4096
ENV NODE_OPTIONS=--max-old-space-size=${MAX_OLD_SPACE_SIZE} \
HUSKY=0
COPY package.json yarn.lock .yarnrc.yml turbo.json i18n.json ./
COPY .yarn ./.yarn
COPY apps/scheduler/package.json ./apps/scheduler/package.json
COPY apps/scheduler/docker-patch.js ./docker-patch.js
COPY packages ./packages
# Husky fails without a .git directory (excluded by .dockerignore). Strip it
# from postinstall so turbo run post-install (prisma generate etc.) still runs.
RUN node docker-patch.js && yarn config set httpTimeout 1200000 && yarn install
# ── Stage 2: build the scheduler ───────────────────────────────────────────────
FROM deps AS builder
# next build evaluates @calcom/features imports, so provide build-time secrets.
# Real values are injected at runtime by compose.
ARG NEXTAUTH_SECRET=secret
ARG CALENDSO_ENCRYPTION_KEY=secret
ARG DATABASE_URL=postgresql://calcom:calcom@postgres:5432/calcom
ENV NODE_ENV=production
# Replace scheduler source with the updated version and rebuild
COPY apps/scheduler ./apps/scheduler
RUN NEXTAUTH_SECRET=${NEXTAUTH_SECRET} \