2022-12-24 21:34:44 -05:00
|
|
|
FROM nginx:alpine
|
2022-12-25 18:19:44 -05:00
|
|
|
# Install Node
|
|
|
|
RUN apk add --update npm
|
2022-12-26 19:55:55 -05:00
|
|
|
COPY nginx/nginx.conf /etc/nginx/nginx.conf
|
2022-12-25 18:19:44 -05:00
|
|
|
WORKDIR /build
|
|
|
|
# Dependencies
|
|
|
|
COPY package.json package.json
|
|
|
|
COPY package-lock.json package-lock.json
|
|
|
|
RUN npm i
|
|
|
|
# Copy react build assets
|
|
|
|
COPY public public
|
|
|
|
COPY src src
|
|
|
|
COPY index.html .
|
|
|
|
COPY vite.config.js .
|
|
|
|
# Build static web files
|
2024-08-09 20:19:26 -06:00
|
|
|
RUN npm run build
|
2022-12-24 21:34:44 -05:00
|
|
|
# Set working directory to nginx asset directory
|
|
|
|
# Remove default nginx static assets
|
2022-12-25 18:19:44 -05:00
|
|
|
WORKDIR /usr/share/nginx/html
|
2023-08-02 15:18:41 -06:00
|
|
|
RUN rm -Rf ./*
|
|
|
|
# Move build nginx and update permissions
|
2022-12-25 18:19:44 -05:00
|
|
|
RUN mv /build/dist/* .
|
2023-08-02 15:18:41 -06:00
|
|
|
RUN chown -R nginx:nginx /usr/share/nginx/html
|
2022-12-24 21:34:44 -05:00
|
|
|
# Containers run nginx with global directives and daemon off
|
2022-12-25 18:19:44 -05:00
|
|
|
ENTRYPOINT ["nginx", "-g", "daemon off;"]
|