fix(docker): rewrite backend Dockerfile with explicit COPY + .tarballs/ for file: deps
This commit is contained in:
parent
8fdc7b57d0
commit
b40097633f
@ -1,24 +1,26 @@
|
||||
# ── Stage 1: Install ──────────────────────────────────
|
||||
FROM node:20-alpine AS deps
|
||||
# Pre-requisite: run ./scripts/docker-prep.sh to pack @bytelyst/* tarballs
|
||||
# ── Stage 1: Build ────────────────────────────────────
|
||||
FROM node:22-alpine AS builder
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci --production=false
|
||||
COPY .tarballs/ ./.tarballs/
|
||||
RUN npm ci --ignore-scripts
|
||||
|
||||
# ── Stage 2: Build ────────────────────────────────────
|
||||
FROM node:20-alpine AS build
|
||||
WORKDIR /app
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
COPY tsconfig.json ./
|
||||
COPY src/ ./src/
|
||||
RUN npx tsc
|
||||
|
||||
# ── Stage 3: Runtime ──────────────────────────────────
|
||||
FROM node:20-alpine AS runtime
|
||||
# ── Stage 2: Runtime ──────────────────────────────────
|
||||
FROM node:22-alpine
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
|
||||
COPY --from=build /app/dist ./dist
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY package.json ./
|
||||
COPY package.json package-lock.json ./
|
||||
COPY .tarballs/ ./.tarballs/
|
||||
RUN npm ci --omit=dev --ignore-scripts
|
||||
|
||||
COPY --from=builder /app/dist ./dist
|
||||
|
||||
EXPOSE 4016
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user