-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (27 loc) · 743 Bytes
/
Dockerfile
File metadata and controls
42 lines (27 loc) · 743 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
FROM node:20-alpine AS builder
WORKDIR /app
ARG PORT
ARG DATABASE_URL
ENV PORT=$PORT \
DATABASE_URL=$DATABASE_URL
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
COPY prisma ./prisma
RUN yarn prisma generate
COPY tsconfig.json ./
COPY src ./src
RUN yarn tsc
FROM node:20-alpine AS production
WORKDIR /app
RUN addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile --production && yarn cache clean
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
COPY prisma ./prisma
COPY prisma.config.js ./
RUN chown -R nodejs:nodejs /app
USER nodejs
EXPOSE 3000
CMD ["yarn", "run", "start"]