forked from StellarFlow-Network/stellarflow-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (28 loc) · 1011 Bytes
/
Dockerfile
File metadata and controls
39 lines (28 loc) · 1011 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
# Builder stage: install all deps, generate Prisma client, build TypeScript, then prune dev deps
FROM node:20-alpine AS builder
WORKDIR /usr/src/app
# Install all dependencies (including devDependencies needed for build)
COPY package*.json ./
COPY package-lock.json ./
RUN npm ci
# Copy source and schema
COPY tsconfig.json ./
COPY prisma ./prisma
COPY src ./src
# Generate Prisma client and build
RUN npx prisma generate
RUN npm run build
# Remove devDependencies so node_modules contains only production packages
RUN npm prune --production
# Runner stage: only copy production node_modules and built dist
FROM node:20-alpine AS runner
WORKDIR /usr/src/app
ENV NODE_ENV=production
ENV PORT=3000
# Copy only the production node modules and the compiled output
COPY --from=builder /usr/src/app/node_modules ./node_modules
COPY --from=builder /usr/src/app/dist ./dist
# Expose the API port
EXPOSE 3000
# Start the app directly - avoids needing package.json in final image
CMD ["node", "dist/index.js"]