2023-03-06 12:49:22 -05:00
|
|
|
# Stage 1
|
|
|
|
|
FROM node:19-alpine as builder
|
|
|
|
|
WORKDIR /client
|
|
|
|
|
# copy package.json into the container at /client
|
|
|
|
|
COPY package*.json /client/
|
|
|
|
|
# install dependencies
|
|
|
|
|
RUN npm install
|
|
|
|
|
# Copy the current directory contents into the container at /client
|
|
|
|
|
COPY . /client/
|
2023-03-08 10:38:22 +09:00
|
|
|
# Build webpack artifacts
|
|
|
|
|
RUN npm run build
|
2023-03-06 12:49:22 -05:00
|
|
|
|
|
|
|
|
# Stage 2
|
|
|
|
|
FROM nginx:stable-alpine
|
|
|
|
|
WORKDIR /usr/share/nginx/html
|
|
|
|
|
RUN rm -rf ./*
|
|
|
|
|
COPY --from=builder /client/public /usr/share/nginx/html
|
2023-03-06 15:56:25 -05:00
|
|
|
# Add your nginx.conf
|
|
|
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
2023-03-06 12:49:22 -05:00
|
|
|
ENTRYPOINT ["nginx", "-g", "daemon off;"]
|
2023-03-06 15:56:25 -05:00
|
|
|
|
|
|
|
|
# docker build -t react-client .
|