# Set the base image to node:12-alpine
FROM node:alpine as build

# workaround because we have a static website build which replaces the process.env vars and so we have to build it for all envs separately
ARG ENV=prod

# Specify where our app will live in the container
WORKDIR /app

# Copy the React App to the container
COPY . /app/

# Prepare the container for building React
RUN npm install
# We want the production version
RUN npm run build:${ENV}

# Prepare nginx
FROM nginx:1.22-alpine
COPY --from=build /app/build /usr/share/nginx/html
