From 73d9283b0733231dc87ca147683b65c222d766d1 Mon Sep 17 00:00:00 2001 From: Kally <60466044+kallyas@users.noreply.github.com> Date: Fri, 25 Aug 2023 10:16:52 +0300 Subject: [PATCH] Create Dockerfile --- client/Dockerfile | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 client/Dockerfile diff --git a/client/Dockerfile b/client/Dockerfile new file mode 100644 index 0000000..94d1c58 --- /dev/null +++ b/client/Dockerfile @@ -0,0 +1,29 @@ +# Use the official Node.js image as the base image +FROM node:lts-alpine as build + +# Set the working directory in the container +WORKDIR /app + +# Copy package.json and package-lock.json +COPY client/package.json client/package-lock.json ./ + +# Install dependencies +RUN npm install + +# Copy the rest of the client application files +COPY client/ ./ + +# Build the React app +RUN npm run build + +# Use a lightweight Nginx server as the production server +FROM nginx:1.21.4-alpine + +# Copy the built React app to the Nginx server directory +COPY --from=build /app/build /usr/share/nginx/html + +# Expose port 80 for web traffic +EXPOSE 80 + +# Start Nginx +CMD ["nginx", "-g", "daemon off;"]