# stage1 as builder
FROM node:12-alpine AS BUILDER

WORKDIR /app

# copy to install dependencies
COPY . .

# Install the dependencies and make the folder
RUN npm install && npm run ng build -- --prod

FROM nginx:alpine

#!/bin/sh

WORKDIR /usr/share/nginx/html

COPY nginx.conf /etc/nginx
COPY mime.types /etc/nginx

## Remove default nginx index page
RUN rm -rf ./*

# Copy from the stahg 1
COPY --from=BUILDER /app/dist .

EXPOSE 4200

ENTRYPOINT ["nginx", "-g", "daemon off;"]