FROM node:19.0.0-alpine3.16 AS builder # create user, group and home directory RUN mkdir -p /home/app RUN addgroup -S app && adduser -S app -G app WORKDIR /home/app # install GCC RUN apk add build-base # install Python ENV PYTHONUNBUFFERED=1 RUN apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python RUN python3 -m ensurepip RUN pip3 install --no-cache --upgrade pip setuptools USER app # install dependencies COPY package.json . COPY package-lock.json . RUN npm install # build app COPY . . RUN npm run build FROM nginx:1.23.2-alpine AS runner RUN addgroup -S www && adduser -S www -G www # copy build files COPY --from=builder /home/app/dist /usr/share/nginx/html