28 lines
693 B
Docker
28 lines
693 B
Docker
# Use official node image as the base image
|
|
FROM node:latest as build
|
|
|
|
# Set the working directory
|
|
WORKDIR /usr/local/app
|
|
|
|
COPY package.json yarn.lock /usr/local/app/
|
|
ENV NODE_OPTIONS=--openssl-legacy-provider
|
|
# Install all the dependencies
|
|
RUN yarn install --pure-lockfile --loglevel verbose
|
|
|
|
# Add the source code to app
|
|
COPY ./ /usr/local/app/
|
|
ENV REACT_APP_BASE_URL='/api/'
|
|
# Generate the build of the application
|
|
RUN npm run build
|
|
|
|
# Stage 2: Serve app with nginx server
|
|
|
|
# Use official nginx image as the base image
|
|
FROM nginx:latest
|
|
|
|
# Copy the build output to replace the default nginx contents.
|
|
COPY --from=build /usr/local/app/build /usr/share/nginx/html
|
|
|
|
# Expose port 80
|
|
EXPOSE 80
|