FROM node:16 as builder ARG VITE_API_URL ARG VITE_KEYCLOAK_CLIENT_ID ARG VITE_KEYCLOAK_CLIENT_SECRET ARG VITE_KEYCLOAK_URL WORKDIR /usr/src/postamates_frontend ENV NODE_OPTIONS=--max_old_space_size=4096 COPY package*.json ./ COPY yarn.lock ./ RUN yarn install COPY . . RUN yarn build FROM scratch AS host-export COPY --from=builder /usr/src/postamates_frontend/dist . # first create dist directory to avoid overstrict permissions # mkdir ../dist # then compile the result into that directory using buildkit # DOCKER_BUILDKIT=1 docker build --file Dockerfile-mergefront --output ../dist .