-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
32 lines (26 loc) · 849 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Stage 1: Build the React application
FROM node:18 as build
WORKDIR /app
# Copy package files
COPY package*.json ./
# Clean and setup npm
RUN npm cache clean --force && \
npm set legacy-peer-deps=true
# Install dependencies in a specific order
RUN npm install && \
npm install @jridgewell/[email protected] && \
npm install @babel/[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 rebuild && npm run build
# Stage 2: Serve the app with nginx
FROM nginx:stable-alpine
COPY --from=build /app/build /usr/share/nginx/html
COPY entrypoint.sh /entrypoint.sh
COPY public/env.template.js /usr/share/nginx/html/env.template.js
RUN chmod +x /entrypoint.sh
EXPOSE 80
ENTRYPOINT ["/entrypoint.sh"]