Move runtime's USER directive above WORKDIR

This commit is contained in:
Maciej Pędzich 2024-07-22 09:28:41 +02:00
parent a6a6f51d00
commit daff508183
Signed by: maciejpedzich
GPG Key ID: CE4A303D84882F0D

View File

@ -1,14 +1,14 @@
FROM node:lts-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
RUN npm i
COPY . .
RUN npm run build
FROM node:lts-alpine AS runtime
USER node
WORKDIR /app
ENV NODE_ENV production
USER node
COPY --chown=node:node package*.json ./
RUN npm ci --omit=dev
COPY --from=build --chown=node:node /app/dist ./dist