Skip to content

Commit

Permalink
Update Dockerfile to use Node 18 and optimize build process
Browse files Browse the repository at this point in the history
- Upgraded Node.js version from 14 to 18 for improved performance.
- Implemented a clean install of npm dependencies with legacy peer dependencies support.
- Added specific package installations for @jridgewell/gen-mapping and @babel/generator.
- Increased memory allocation for the build process by setting NODE_OPTIONS to 4096 MB.
  • Loading branch information
xuwenyihust committed Dec 10, 2024
1 parent 8dc6f7c commit 5391709
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions webapp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
# Stage 1: Build the React application
FROM node:14 as build
FROM node:18 as build
WORKDIR /app

# Copy package files
COPY package*.json ./
RUN npm install

# Clean install with specific dependency resolution
RUN npm cache clean --force && \
npm install --legacy-peer-deps && \
npm install @jridgewell/[email protected] && \
npm install @babel/[email protected]

# Copy the rest of the application
COPY . .

# Build with increased memory limit
ENV NODE_OPTIONS="--max-old-space-size=4096"
RUN npm run build

# Stage 2: Serve the app with nginx
Expand Down

0 comments on commit 5391709

Please sign in to comment.