- Copy `package.json` and `package-lock.json` to install only production dependencies. - Use `npm ci --only=production` for faster and more reliable builds.
This commit is contained in:
@ -10,6 +10,13 @@ FROM node:20-alpine AS production
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
|
# Kopiere package.json und package-lock.json für Produktions-Abhängigkeiten
|
||||||
|
COPY package*.json ./
|
||||||
|
# Installiere nur Produktions-Abhängigkeiten
|
||||||
|
RUN npm ci --only=production && npm cache clean --force
|
||||||
|
|
||||||
|
# Kopiere das gebaute Projekt
|
||||||
COPY --from=build /app/dist ./dist
|
COPY --from=build /app/dist ./dist
|
||||||
|
|
||||||
# install minimal deps to run node if needed (alpine already has node)
|
# install minimal deps to run node if needed (alpine already has node)
|
||||||
|
|||||||
Reference in New Issue
Block a user