Files
safavimohadeseh78andCursor a5a4d79a32
Frontend CI / unit (test, type-check, build) (push) Successful in 2m35s
Frontend CI / browser E2E (frontend + pinned backend) (push) Successful in 9m54s
chore: add a manual workflow for offline npm caches
CI can download Linux dependencies so the server can build images without npm.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-25 12:52:27 +03:30

53 lines
1.3 KiB
Docker

# syntax=docker/dockerfile:1
# Offline production image. Build context is the backend source tree
# plus ./offline-npm-cache. Base image must already exist locally:
# node:22.18.0-bookworm
FROM node:22.18.0-bookworm AS build
WORKDIR /app
ENV npm_config_build_from_source=true \
npm_config_nodedir=/usr/local
COPY offline-npm-cache /offline-npm-cache
COPY package.json package-lock.json ./
RUN npm ci --offline --cache /offline-npm-cache --no-audit --no-fund
COPY nest-cli.json tsconfig.json tsconfig.build.json ./
COPY src ./src
RUN npm run build
FROM node:22.18.0-bookworm AS production
WORKDIR /app
ENV NODE_ENV=production \
PORT=3000 \
HOST=0.0.0.0 \
DB_PATH=/app/data/app.db \
npm_config_build_from_source=true \
npm_config_nodedir=/usr/local
COPY package.json package-lock.json ./
COPY --from=build /offline-npm-cache /offline-npm-cache
RUN npm ci --offline --omit=dev --cache /offline-npm-cache --no-audit --no-fund \
&& rm -rf /offline-npm-cache /root/.npm
COPY --from=build /app/dist ./dist
RUN mkdir -p /app/data \
&& chown -R node:node /app
USER node
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD node -e "fetch('http://127.0.0.1:3000/health/ready').then((r)=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"
CMD ["node", "dist/main.js"]