25 lines
701 B
Docker
25 lines
701 B
Docker
FROM nginx:alpine
|
|
# Install Node
|
|
RUN apk add --update npm
|
|
COPY nginx/nginx.conf /etc/nginx/nginx.conf
|
|
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
|
|
RUN npm run build
|
|
# Set working directory to nginx asset directory
|
|
# Remove default nginx static assets
|
|
WORKDIR /usr/share/nginx/html
|
|
RUN rm -Rf ./*
|
|
# Move build nginx and update permissions
|
|
RUN mv /build/dist/* .
|
|
RUN chown -R nginx:nginx /usr/share/nginx/html
|
|
# Containers run nginx with global directives and daemon off
|
|
ENTRYPOINT ["nginx", "-g", "daemon off;"]
|