-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (34 loc) · 1.13 KB
/
Dockerfile
File metadata and controls
50 lines (34 loc) · 1.13 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Use Node.js 24 image as base
FROM node:24-slim AS builder
# Set working directory inside the container
WORKDIR /app
# Copy package files for better layer caching
COPY package*.json ./
# Install dependencies (including dev dependencies for build)
RUN npm ci
# Copy prisma schema and TypeScript files
COPY prisma ./prisma/
# Generate Prisma client
RUN npx prisma generate
# Copy TypeScript configuration and source code
COPY tsconfig.json ./
COPY src ./src/
# Build the TypeScript application (this will compile both src/ and prisma/)
RUN npm run build
# Production stage
FROM node:24-slim
# Install openssl for Prisma (required for PostgreSQL)
RUN apt-get update -y && apt-get install -y openssl && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install production dependencies only
RUN npm ci --only=production
# Copy Prisma files
COPY prisma ./prisma/
# Generate Prisma client in production
RUN npx prisma generate
# Copy built application from builder stage
COPY --from=builder /app/dist ./dist
# Start the application with migrations
CMD ["sh", "-c", "npx prisma migrate deploy && npm start"]