FROM node:latest AS build

WORKDIR /app
COPY package.json /
COPY package-lock.json /
RUN npm install
COPY . ./
RUN npm run build

FROM georgjung/nginx-brotli:mainline-alpine
RUN rm -f /etc/nginx/nginx.conf
COPY ./nginx.conf /etc/nginx/nginx.conf
COPY --from=build /app/build /usr/share/nginx/html
RUN chown -R nginx:nginx /usr/share/nginx/html