-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
43 lines (34 loc) · 1.03 KB
/
Dockerfile
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
FROM node:20-alpine AS base
FROM base AS deps
WORKDIR /app
# Reference: https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine
RUN apk update && \
apk upgrade && \
apk add --no-cache libc6-compat
COPY package.json yarn.lock ./
COPY prisma ./
RUN yarn --frozen-lockfile --ignore-engines
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN yarn build \
&& mkdir logs \
&& mkdir uploads
FROM base AS runner
WORKDIR /app
RUN apk add dumb-init
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 core
USER core
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/.env.example ./.env.example
COPY --from=builder /app/package.json .
COPY prisma ./
COPY --from=builder --chown=core:nodejs /app/dist ./dist
COPY --from=builder --chown=core:nodejs /app/logs ./logs
COPY --from=builder --chown=core:nodejs /app/uploads ./uploads
EXPOSE 3000
ENV PORT 3000
ENV NODE_ENV production
CMD ["dumb-init", "node", "."]