This commit is contained in:
shafi54 2026-03-16 19:55:06 +05:30
parent f2763b0597
commit 0c84808637

View file

@ -8,7 +8,7 @@ WORKDIR /app
FROM base AS pruner
WORKDIR /app
# Copy config files first for better caching
COPY package.json bun.lock turbo.json ./
COPY package.json turbo.json ./
COPY apps/backend/package.json ./apps/backend/
COPY apps/fallback-ui/package.json ./apps/fallback-ui/
COPY packages/shared/ ./packages/shared
@ -16,19 +16,21 @@ COPY packages/ui/package.json ./packages/ui/
RUN bun install -g turbo
COPY . .
RUN turbo prune --scope=backend --scope=fallback-ui --scope=common-ui --scope=@packages/shared --docker
RUN find . -path "./node_modules" -prune -o -print
# 3. ---- Builder ----
FROM base AS builder
WORKDIR /app
# Copy package files first to cache bun install
COPY --from=pruner /app/out/json/ .
COPY --from=pruner /app/out/bun.lock ./bun.lock
RUN cat ./bun.lock
#COPY --from=pruner /app/out/bun.lock ./bun.lock
#RUN cat ./bun.lock
COPY --from=pruner /app/turbo.json .
RUN bun install
# Copy source code after dependencies are installed
COPY --from=pruner /app/out/full/ .
RUN bunx turbo run build --filter=fallback-ui... --filter=backend...
RUN find . -path "./node_modules" -prune -o -print
# 4. ---- Runner ----
FROM base AS runner
@ -36,7 +38,7 @@ WORKDIR /app
ENV NODE_ENV=production
# Copy package files and install production deps
COPY --from=pruner /app/out/json/ .
COPY --from=pruner /app/out/bun.lock ./bun.lock
#COPY --from=pruner /app/out/bun.lock ./bun.lock
RUN bun install --production
# Copy built applications
COPY --from=builder /app/apps/backend/dist ./apps/backend/dist