Improve production image size
This commit is contained in:
parent
a3a573ef00
commit
5e330d8f54
1 changed files with 9 additions and 4 deletions
|
@ -6,11 +6,16 @@ RUN npm ci
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
|
# Deps stage
|
||||||
|
FROM node:18-alpine AS dependencies
|
||||||
|
WORKDIR /app
|
||||||
|
COPY package*.json .
|
||||||
|
RUN npm ci --omit=dev
|
||||||
|
|
||||||
# Prod stage
|
# Prod stage
|
||||||
FROM node:18-alpine AS production
|
FROM node:18-alpine AS production
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package*.json .
|
COPY package*.json .
|
||||||
RUN npm ci --omit=dev
|
|
||||||
COPY --from=build /app/dist ./dist
|
COPY --from=build /app/dist ./dist
|
||||||
|
COPY --from=dependencies /app/node_modules ./node_modules
|
||||||
CMD ["npm", "run", "start"]
|
CMD ["npm", "run", "start"]
|
Loading…
Reference in a new issue