28 lines
748 B
Docker
28 lines
748 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
|
|
COPY docker/default.conf.template /etc/nginx/templates/
|
|
# Expose port 80
|
|
EXPOSE 80
|