Dockerfile no longer includes devDependencies or ./src

This commit is contained in:
Nix Krystik
2026-05-20 02:42:45 +08:00
parent 625231480b
commit 4f365db12e
5 changed files with 21 additions and 38 deletions
+17 -6
View File
@@ -1,10 +1,21 @@
FROM node:22-alpine
FROM node:22-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm i
RUN npm run build
CMD ["npm", "run", "start"]
# ----------
FROM node:22-alpine
WORKDIR /app
ENV NODE_ENV=production
COPY package*.json ./
RUN npm install --omit=dev
COPY --from=build /app/dist ./dist
USER node
CMD ["node", "./dist/index.js"]