From 6a3b5f780b369b3617a13c2eddcc8f63f1a02834 Mon Sep 17 00:00:00 2001 From: jafreli Date: Sun, 26 Jan 2025 00:11:33 +0100 Subject: [PATCH] react test --- dockerfile | 22 +++++++++------------- package.json | 3 ++- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/dockerfile b/dockerfile index 698ac83..2bdfd77 100644 --- a/dockerfile +++ b/dockerfile @@ -1,11 +1,7 @@ -# Dockerfile -# ------------ -# Create a production-ready Docker container to host the React app. - -# Use an official Node.js runtime as a parent image +# Stage 1: Build React App FROM node:18 as build -# Set the working directory +# Set working directory WORKDIR /app # Copy package.json and package-lock.json @@ -14,20 +10,20 @@ COPY package*.json ./ # Install dependencies RUN npm install -# Copy the app's source code +# Copy the rest of the source code COPY . . -# Build the app for production +# Build the app RUN npm run build -# Use a lightweight web server to serve the built app +# Stage 2: Serve the app using Nginx FROM nginx:alpine -# Copy the build files from the previous stage +# Copy build artifacts to Nginx's web root COPY --from=build /app/build /usr/share/nginx/html -# Expose the port the app runs on +# Expose port 80 EXPOSE 80 -# Start the Nginx server -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file +# Start Nginx +CMD ["nginx", "-g", "daemon off;"] diff --git a/package.json b/package.json index be43950..844b736 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "dependencies": { "pocketbase": "^0.13.0", "react": "^18.2.0", - "react-dom": "^18.2.0", + "react-dom": "^18.2.0", + "react-scripts": "^5.0.1", "react-router-dom": "^6.14.1" }, "devDependencies": {