2021-08-12 03:00:57 +02:00
|
|
|
# defining version of the base image
|
|
|
|
FROM node:alpine as build
|
|
|
|
|
|
|
|
# defining work directory
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
# copying the json files into the image
|
|
|
|
COPY package*.json .
|
|
|
|
COPY patch-webpack.js .
|
|
|
|
|
|
|
|
# copying rest of project
|
2021-08-19 02:14:32 +02:00
|
|
|
RUN --mount=type=cache,target=/app/.npm \
|
|
|
|
npm set cache /app/.npm && \
|
|
|
|
npm ci
|
2021-08-12 03:00:57 +02:00
|
|
|
|
|
|
|
COPY . .
|
|
|
|
|
2021-08-13 23:52:22 +02:00
|
|
|
ARG FRONTEND_ENV=prod
|
2021-08-12 03:00:57 +02:00
|
|
|
# running build script
|
2021-08-13 22:04:22 +02:00
|
|
|
RUN npm run build:${FRONTEND_ENV}
|
2021-08-12 03:00:57 +02:00
|
|
|
|
|
|
|
### STAGE 2: Setup ###
|
|
|
|
# defining nginx image version
|
|
|
|
FROM nginx:alpine
|
|
|
|
|
|
|
|
## Remove default nginx website
|
|
|
|
RUN rm -rf /usr/share/nginx/html/*
|
|
|
|
|
|
|
|
# copy dist output from our first image
|
|
|
|
COPY --from=build /app/dist/cic-staff-client /usr/share/nginx/html
|
|
|
|
|
|
|
|
# copy nginx configuration file
|
|
|
|
COPY nginx.conf /etc/nginx/
|
|
|
|
|
|
|
|
EXPOSE 80
|
|
|
|
|
|
|
|
CMD [ "nginx", "-g", "daemon off;" ]
|