# Build container FROM node:16.14.0-alpine as build WORKDIR /app # Argument to allow building of different apps ARG APP ENV PATH /app/node_modules/.bin:$PATH COPY package.json ./ COPY yarn.lock ./ COPY . ./ RUN apk add python3 make gcc g++ RUN yarn --network-timeout 100000 --verbose --pure-lockfile RUN yarn nx build $APP --network-timeout 100000 --verbose --pure-lockfile # Production environment FROM nginx:stable-alpine ARG APP COPY --from=build /app/dist/apps/$APP /usr/share/nginx/html COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 WORKDIR /usr/share/nginx/html COPY ./env.sh . COPY ./apps/$APP/.env .env # Add bash RUN apk add --no-cache bash RUN chmod +x ./env.sh CMD ["/bin/bash", "-c", "/usr/share/nginx/html/env.sh && nginx -g \"daemon off;\""]