File tree Expand file tree Collapse file tree 4 files changed +42
-9
lines changed
sessions/f7e3dd46-21d0-4413-b015-4f95f0425b14 Expand file tree Collapse file tree 4 files changed +42
-9
lines changed Original file line number Diff line number Diff line change 1- # Use a standard Node.js image instead of the Lambda-specific one
2- FROM node:22-alpine
1+ # --- Stage 1: Build the application ---
2+ FROM node:22-alpine AS builder
33
44WORKDIR /usr/src/app
55
6+ # Copy package files and prisma schema
67COPY package*.json ./
7- # Install production dependencies
8- RUN npm install --omit=dev
8+ COPY prisma ./prisma/
9+
10+ # Install ALL dependencies (including dev dependencies)
11+ RUN npm install
12+
13+ # Explicitly generate the Prisma client to create all the necessary types
14+ RUN npx prisma generate
915
16+ # Copy the rest of your source code
1017COPY . .
11- # Build your TypeScript code
18+
19+ # Build the TypeScript project
1220RUN npm run build
1321
22+ # Remove development dependencies to prepare for the final image
23+ RUN npm prune --production
24+
25+
26+ # --- Stage 2: Create the final, lightweight image ---
27+ FROM node:22-alpine
28+
29+ WORKDIR /usr/src/app
30+
31+ # Copy only the necessary files from the 'builder' stage
32+ COPY --from=builder /usr/src/app/node_modules ./node_modules
33+ COPY --from=builder /usr/src/app/dist ./dist
34+ COPY --from=builder /usr/src/app/prisma ./prisma
35+
1436# Expose the port your app will run on
1537EXPOSE 3000
1638
17- # Change the command to start the server directly
18- CMD [ "node" , "dist/server.js" ]
39+ # Start the server
40+ CMD [ "node" , "dist/server.js" ]
Original file line number Diff line number Diff line change 1+ version : ' 3.8'
2+
3+ services :
4+ backend :
5+ build : .
6+ container_name : ootsav
7+ ports :
8+ - " 3000:3000"
9+ env_file :
10+ - .env
11+ restart : unless-stopped
12+
Original file line number Diff line number Diff line change 33 "version" : " 1.0.0" ,
44 "main" : " dist/server.js" ,
55 "scripts" : {
6- "dev" : " npx nodemon --exec \" npx tsx src/server.ts | npx pino-pretty \" " ,
6+ "dev" : " npx nodemon --exec \" npx tsx src/server.ts" ,
77 "build" : " tsc" ,
88 "start" : " node dist/server.js"
99 },
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments