Skip to content

Commit 7ae525a

Browse files
committed
some changes
1 parent 5946752 commit 7ae525a

File tree

4 files changed

+42
-9
lines changed

4 files changed

+42
-9
lines changed

Dockerfile

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,40 @@
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

44
WORKDIR /usr/src/app
55

6+
# Copy package files and prisma schema
67
COPY 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
1017
COPY . .
11-
# Build your TypeScript code
18+
19+
# Build the TypeScript project
1220
RUN 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
1537
EXPOSE 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" ]

docker-compose.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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+

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
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
},

sessions/f7e3dd46-21d0-4413-b015-4f95f0425b14/creds.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)