24 lines
871 B
Docker
24 lines
871 B
Docker
# Build stage: full toolchain, compile TS -> dist/
|
|
FROM node:22 AS build
|
|
WORKDIR /app
|
|
COPY package.json package-lock.json ./
|
|
# Fail fast and retry on a stalled registry fetch (npm defaults can hang ~10 min).
|
|
RUN npm ci --fetch-timeout=60000 --fetch-retries=5 --fetch-retry-mintimeout=2000 --no-audit --no-fund
|
|
COPY tsconfig.json ./
|
|
COPY src ./src
|
|
RUN npm run build
|
|
|
|
# Runtime stage: production deps only (node-pg-migrate is a prod dep so
|
|
# `npm run migrate` works inside this image for the PreSync Job).
|
|
FROM node:22-slim
|
|
WORKDIR /app
|
|
ENV NODE_ENV=production
|
|
ARG GIT_SHA=dev
|
|
ENV GIT_SHA=${GIT_SHA}
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci --omit=dev --fetch-timeout=60000 --fetch-retries=5 --fetch-retry-mintimeout=2000 --no-audit --no-fund
|
|
COPY --from=build /app/dist ./dist
|
|
COPY migrations ./migrations
|
|
USER node
|
|
EXPOSE 3000
|
|
CMD ["node", "dist/bin/server.js"]
|