Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 97bc8f9

Browse files
committedApr 4, 2025·
updated dockerfile 1
1 parent 26b6714 commit 97bc8f9

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed
 

‎Dockerfile

+18-5
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,36 @@
11
# Stage 1: Build
22
FROM node:18-alpine as build
33

4-
# Set working dir
4+
# Set working directory
55
WORKDIR /app
66

7-
# Copy entire repo
7+
# Copy package.json and lock files first (for better caching)
8+
COPY package*.json ./
9+
COPY .npmrc .npmrc
10+
11+
# Optional: clean npm cache (helps with weird issues)
12+
RUN npm cache clean --force
13+
14+
# Manually install ajv v6 and ajv-keywords v3 to avoid breaking changes
15+
RUN npm install ajv@6 ajv-keywords@3 --legacy-peer-deps
16+
17+
# Now copy the rest of the app
818
COPY . .
919

10-
# Install workspace dependencies
20+
# Install remaining dependencies with legacy flag
1121
RUN npm install --legacy-peer-deps
1222

13-
# Build using your monorepo script
23+
# Build the app
1424
RUN npm run build
1525

1626
# Stage 2: Serve the build output
1727
FROM nginx:alpine
1828

19-
# Copy only the frontend build (adjust path if different)
29+
# Copy only the frontend build output
2030
COPY --from=build /app/packages/react-scripts/build /usr/share/nginx/html
2131

32+
# Expose port 80
2233
EXPOSE 80
34+
35+
# Start nginx
2336
CMD ["nginx", "-g", "daemon off;"]

0 commit comments

Comments
 (0)
Please sign in to comment.