-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
42 lines (31 loc) · 905 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
## build runner
FROM node:lts-alpine as build-runner
# Set temp directory
WORKDIR /tmp/app
# Move package.json and package-lock.json
COPY package.json package-lock.json* ./
# Install dependencies
RUN npm ci && npm cache clean --force
# Move prisma
COPY prisma ./prisma
# Generate prisma
RUN npx prisma generate
# Move source files
COPY src ./src
COPY tsconfig.json .
# Build project
RUN npm run build
## producation runner
FROM node:lts-alpine as prod-runner
# Set work directory
WORKDIR /app
# Copy package.json from build-runner
COPY --from=build-runner /tmp/app/package.json /app/package.json
# Install dependencies
RUN npm install --omit=dev
# Move build files
COPY --from=build-runner /tmp/app/build /app/build
COPY --from=build-runner /tmp/app/node_modules/.prisma /app/node_modules/.prisma
COPY --from=build-runner /tmp/app/prisma /app/prisma
# Start bot
CMD [ "node", "build/main.js" ]