Skip to content

Commit 23726cf

Browse files
committed
Refactor Dockerfile for improved npm dependency management and build process
- Updated npm installation commands to set legacy peer dependencies and install packages in a specific order. - Cleaned npm cache and rebuilt before running the build command to ensure a fresh environment. - Increased clarity and efficiency in the Dockerfile setup for the web application.
1 parent 5391709 commit 23726cf

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

webapp/Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,22 @@ WORKDIR /app
55
# Copy package files
66
COPY package*.json ./
77

8-
# Clean install with specific dependency resolution
8+
# Clean and setup npm
99
RUN npm cache clean --force && \
10-
npm install --legacy-peer-deps && \
10+
npm set legacy-peer-deps=true
11+
12+
# Install dependencies in a specific order
13+
RUN npm install && \
1114
npm install @jridgewell/[email protected] && \
12-
npm install @babel/[email protected]
15+
npm install @babel/[email protected] && \
16+
npm install @babel/[email protected]
1317

1418
# Copy the rest of the application
1519
COPY . .
1620

1721
# Build with increased memory limit
1822
ENV NODE_OPTIONS="--max-old-space-size=4096"
19-
RUN npm run build
23+
RUN npm rebuild && npm run build
2024

2125
# Stage 2: Serve the app with nginx
2226
FROM nginx:stable-alpine

0 commit comments

Comments
 (0)