1- # FROM node:21-alpine3.18 as builder
2-
3- # WORKDIR /app
4- # COPY package.json ./
5- # COPY tsconfig.json ./
6- # COPY src ./src
7- # COPY tools ./tools
8- # RUN npm install -g npm@latest
9- # RUN npm run ci && npm install -g nodemon
10-
11-
12- # FROM node:21-alpine3.18
13-
14- # WORKDIR /app
15- # RUN apk add --no-cache curl
16- # COPY package.json ./
17- # COPY tsconfig.json ./
18- # COPY src ./src
19- # RUN npm install -g pm2 npm@latest
20- # RUN npm ci --production
21- # COPY --from=builder /app/build ./build
22-
23- # EXPOSE 4002
24-
25- # CMD ["npm", "run", "dev"]
261# Stage 1: Build the application
272FROM node:20-alpine AS builder
283
294WORKDIR /usr/src/app
305
316# Copy package files first for better caching
327COPY package*.json ./
33- COPY yarn.lock* ./
348
359# Install dependencies (including devDependencies for building)
3610RUN npm install
@@ -50,17 +24,12 @@ WORKDIR /usr/src/app
5024COPY package*.json ./
5125RUN npm install --only=production
5226
53- COPY --from=builder /usr/src/app/build ./build
5427# Copy built assets from builder stage
55- # COPY --from=builder /usr/src/app/build ./build
56- # COPY --from=builder /usr/src/app/node_modules ./node_modules
57-
58- # Copy other necessary files (like config, public folder, etc.)
59- # COPY --from=builder /usr/src/app/public ./public
60- # COPY --from=builder /usr/src/app/server.js ./
28+ COPY --from=builder /usr/src/app/build ./build
29+ COPY --from=builder /usr/src/app/node_modules ./node_modules
6130
6231# Expose the port your app runs on
63- EXPOSE 4000
32+ EXPOSE 4002
6433
6534# Command to run the server
6635CMD ["npm" , "run" ,"start" ]
0 commit comments