-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
49 lines (36 loc) · 898 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
## build runner
FROM node:lts-alpine as build-runner
# Add git
RUN apk add git
# Set temp directory
WORKDIR /tmp/app
# Move package.json
COPY package.json .
# Install dependencies
RUN npm install -g pnpm
RUN pnpm install
# Move source files
COPY prisma ./prisma
COPY src ./src
COPY tsconfig.json .
# Build project
RUN pnpx prisma generate
RUN pnpm run build
## producation runner
FROM node:lts-alpine as prod-runner
# Add git
RUN apk add git
# Set work directory
WORKDIR /app
# Copy package.json from build-runner
COPY --from=build-runner /tmp/app/package.json /app/package.json
# Copy prisma from build-runner
COPY --from=build-runner /tmp/app/prisma /app/prisma
# Install dependencies
RUN npm install -g pnpm
RUN pnpm install --only=production
RUN pnpx prisma generate
# Move build files
COPY --from=build-runner /tmp/app/dist /app/dist
# Start bot
CMD [ "node", "dist/index.js" ]