-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (28 loc) · 803 Bytes
/
Dockerfile
File metadata and controls
40 lines (28 loc) · 803 Bytes
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
# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files and install dependencies
COPY package*.json ./
RUN npm ci
# Copy source code
COPY . .
# Build the application
RUN npm run build
# Production stage
FROM node:20-alpine
WORKDIR /app
# Copy package files and install production dependencies
COPY package*.json ./
RUN npm ci --only=production
# Copy built application from builder stage
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/prisma ./prisma
# Create uploads and logs directories
RUN mkdir -p uploads logs
# Set environment variables
ENV NODE_ENV=production
ENV PORT=5000
# Expose the application port
EXPOSE 5000
# Run database migrations and start the application
CMD ["npx", "prisma", "migrate", "deploy", "&&", "node", "dist/src/index.js"]