File tree 1 file changed +18
-5
lines changed
1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change 1
1
# Stage 1: Build
2
2
FROM node:18-alpine as build
3
3
4
- # Set working dir
4
+ # Set working directory
5
5
WORKDIR /app
6
6
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
8
18
COPY . .
9
19
10
- # Install workspace dependencies
20
+ # Install remaining dependencies with legacy flag
11
21
RUN npm install --legacy-peer-deps
12
22
13
- # Build using your monorepo script
23
+ # Build the app
14
24
RUN npm run build
15
25
16
26
# Stage 2: Serve the build output
17
27
FROM nginx:alpine
18
28
19
- # Copy only the frontend build (adjust path if different)
29
+ # Copy only the frontend build output
20
30
COPY --from=build /app/packages/react-scripts/build /usr/share/nginx/html
21
31
32
+ # Expose port 80
22
33
EXPOSE 80
34
+
35
+ # Start nginx
23
36
CMD ["nginx" , "-g" , "daemon off;" ]
You can’t perform that action at this time.
0 commit comments