FROM node:12-alpine AS builder ARG APP_HOST ARG API_HOST EXPOSE 80 WORKDIR /home/node RUN apk add gettext COPY ./web/package.json . RUN npm install COPY ./docker/app/.env.keep /home/.env.tmp RUN envsubst '\$API_HOST' < /home/.env.tmp > /home/node/.env && rm /home/.env.tmp COPY ./docker/app/app.conf /home/node/app.conf.tmp RUN envsubst '\$APP_HOST' < /home/node/app.conf.tmp > /home/node/app.conf COPY ./web . RUN npm run build FROM nginx:alpine WORKDIR /usr/share/nginx/html COPY --from=builder /home/node/dist . COPY --from=builder /home/node/app.conf /etc/nginx/conf.d/default.conf