log-viewer/frontend/Dockerfile

40 lines
898 B
Docker
Raw Permalink Normal View History

2022-02-09 11:56:34 +00:00
# pull official base image
2022-02-08 21:03:34 +00:00
FROM node AS builder
2022-02-09 11:56:34 +00:00
# set working directory
WORKDIR /app
# install app dependencies
#copies package.json and package-lock.json to Docker environment
COPY package.json ./
# Installs all node packages
RUN npm install
# Copies everything over to Docker environment
COPY . ./
RUN npm run build
#Stage 2
#######################################
#pull the official nginx:1.19.0 base image
2022-02-08 21:03:34 +00:00
FROM nginx
2022-02-09 11:56:34 +00:00
#copies React to the container directory
# Set working directory to nginx resources directory
WORKDIR /usr/share/nginx/html
# Remove default nginx static resources
RUN rm -rf ./*
RUN apt-get install bash
# Copies configuration files
2022-02-08 21:03:34 +00:00
COPY ./default.conf /etc/nginx/conf.d/default.conf
2022-02-09 11:56:34 +00:00
# Copies static resources from builder stage
COPY --from=builder /app/build .
# Containers run nginx with global directives and daemon off
2022-02-08 21:03:34 +00:00
ENTRYPOINT ["nginx", "-g", "daemon off;"]