cic-staff-client/Dockerfile

35 lines
673 B
Docker
Raw Normal View History

2020-12-28 11:31:35 +01:00
### STAGE 1: Build ###
# defining version of the base image
2020-12-28 12:43:53 +01:00
FROM node:alpine as build
2020-12-28 11:31:35 +01:00
# defining work directory
WORKDIR /app
# copying the json files into the image
COPY package*.json ./
RUN npm install
# copying rest of project
COPY . .
# running build script
RUN npm run build --prod
### STAGE 2: Setup ###
# defining nginx image version
2020-12-28 12:43:53 +01:00
FROM nginx:alpine
2020-12-28 11:31:35 +01:00
## 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/conf.d/default.conf
EXPOSE 80 443
CMD [ "nginx", "-g", "daemon off;" ]