- update: Dockerfile layer reordering to speed up build times and lower image space needed

- add: .dockerignore file to reduce file transfers and remove unneeded files in image
This commit is contained in:
2024-12-21 13:10:37 -05:00
parent 0777bd4605
commit 754522b080
10 changed files with 101 additions and 63 deletions

View File

@@ -1,21 +1,17 @@
# Step 1: Build the React app
FROM node:20 AS build
FROM node:22-alpine AS build
# Set working directory
WORKDIR /app
# Copy package.json and install dependencies
COPY package*.json ./
RUN npm install
# Copy the source code
RUN npm ci
COPY . .
# Build the React app
RUN npm run build
# Step 2: Serve the React app using nginx
FROM nginx:1.25
FROM nginx:alpine
# Copy the built React files to the nginx html folder
COPY --from=build /app/build /usr/share/nginx/html