diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..67668448 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +# Stage 1: Build the application +FROM node:18-alpine AS build + +# Setting up the working directory inside the container +WORKDIR /app + +# Copy package.json and package-lock.json to the working directory +COPY package.json package-lock.json ./ + +# Install dependencies +RUN npm ci --production + +# Copy the rest of the application code to the working directory +COPY . . + +# Build the React application +RUN npm run build + +# Stage 2: Serve the application +FROM nginx:alpine + +# Copy built files from the previous stage +COPY --from=build /app/build /usr/share/nginx/html + +# Expose the port the app runs on +EXPOSE 80 + +# Start the Nginx server +CMD ["nginx", "-g", "daemon off;"]