-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (29 loc) · 779 Bytes
/
Dockerfile
File metadata and controls
42 lines (29 loc) · 779 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
41
42
# -------- Build Stage --------
FROM node:24-alpine AS builder
WORKDIR /app
COPY . .
RUN npm ci
RUN npm run db:generate
RUN npm run build
# -------- Production Stage --------
FROM node:24-alpine AS production
# Create an unprivileged user
RUN addgroup -S nodegroup && adduser -S nodeuser -G nodegroup
WORKDIR /app
# Can be useful for debugging
RUN apk add nano
RUN apk add --no-cache curl
COPY .env ./
COPY .env.common ./
COPY prisma.config.ts ./
COPY package*.json ./
RUN npm ci --omit=dev --ignore-scripts
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/database-manager ./database-manager
# Changing file ownership
RUN chown -R nodeuser:nodegroup /app
USER nodeuser
ENV NODE_ENV=production
ENV PORT=3000
EXPOSE 3000
CMD ["node", "dist/src/main.js"]