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 ──────────────────────────────────
|
# Pre-requisite: run ./scripts/docker-prep.sh to pack @bytelyst/* tarballs
|
||||||
FROM node:20-alpine AS deps
|
# ── Stage 1: Build ────────────────────────────────────
|
||||||
|
FROM node:22-alpine AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY package.json package-lock.json ./
|
COPY package.json package-lock.json ./
|
||||||
RUN npm ci --production=false
|
COPY .tarballs/ ./.tarballs/
|
||||||
|
RUN npm ci --ignore-scripts
|
||||||
|
|
||||||
# ── Stage 2: Build ────────────────────────────────────
|
COPY tsconfig.json ./
|
||||||
FROM node:20-alpine AS build
|
COPY src/ ./src/
|
||||||
WORKDIR /app
|
RUN npx tsc
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
|
||||||
COPY . .
|
|
||||||
RUN npm run build
|
|
||||||
|
|
||||||
# ── Stage 3: Runtime ──────────────────────────────────
|
# ── Stage 2: Runtime ──────────────────────────────────
|
||||||
FROM node:20-alpine AS runtime
|
FROM node:22-alpine
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
COPY --from=build /app/dist ./dist
|
COPY package.json package-lock.json ./
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
COPY .tarballs/ ./.tarballs/
|
||||||
COPY package.json ./
|
RUN npm ci --omit=dev --ignore-scripts
|
||||||
|
|
||||||
|
COPY --from=builder /app/dist ./dist
|
||||||
|
|
||||||
EXPOSE 4016
|
EXPOSE 4016
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user