-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
51 lines (30 loc) · 810 Bytes
/
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
44
45
46
47
48
49
50
51
FROM node:20.12-alpine as base
FROM base as backend_deps
WORKDIR /app
COPY ./backend ./
RUN npm ci
RUN npx prisma generate
FROM base as frontend_deps
WORKDIR /app
RUN apk add --no-cache libc6-compat
COPY ./frontend ./
RUN npm ci
FROM backend_deps as backend_build
RUN npm run build
FROM frontend_deps as frontend_build
RUN apk add --no-cache libc6-compat
ENV NEXT_TELEMETRY_DISABLED 1
RUN npm run build
FROM base as production
WORKDIR /app
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 runner
RUN npm install -g pm2
RUN apk add curl
COPY --from=backend_build --chown=runner:nodejs /app ./backend
COPY --from=frontend_build --chown=runner:nodejs /app ./frontend
COPY ./process.json .
USER runner
EXPOSE 3000
EXPOSE 9000
CMD ["pm2-runtime", "start", "process.json"]