From 98e51141a32b073ee6c28aec8f8b58fb2059bca4 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 25 Oct 2024 23:10:00 +0530 Subject: [PATCH] feat: change port --- src/Dockerfile | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/Dockerfile diff --git a/src/Dockerfile b/src/Dockerfile new file mode 100644 index 00000000..27aed44a --- /dev/null +++ b/src/Dockerfile @@ -0,0 +1,32 @@ +# Stage 1: Build the React frontend +FROM node:18-alpine AS build + +# Set working directory +WORKDIR /app + +# Copy package.json and package-lock.json +COPY frontend/package*.json ./ + +# Install dependencies +RUN npm install + +# Copy the entire frontend project +COPY frontend/ ./ + +# Build the frontend +RUN npm run build + +# Stage 2: Serve the static files with nginx +FROM nginx:stable-alpine + +# Copy build output from the previous stage +COPY --from=build /app/build /usr/share/nginx/html + +# Copy nginx configuration (if needed) +COPY frontend/nginx.conf /etc/nginx/conf.d/default.conf + +# Expose the port NGINX will run on (3000 for React frontend) +EXPOSE 3000 + +# Start NGINX +CMD ["nginx", "-g", "daemon off;"]