forked from CCDirectLink/ccbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
48 lines (35 loc) · 1.04 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
44
45
46
47
48
## build runner
FROM node:20.15.1-alpine AS build-runner
# Add git and gyp deps
RUN apk add git g++ make py3-pip
# Set temp directory
WORKDIR /tmp/app
# Move package.json
COPY package.json .
COPY pnpm-lock.yaml .
COPY dynamic-data ./dynamic-data
# Install dependencies
RUN npm install -g pnpm
RUN pnpm install
# Move source files
COPY src ./src
COPY tsconfig.json .
# Build project
RUN pnpm run build
## producation runner
FROM node:20.15.1-alpine AS prod-runner
# Add git and gyp deps
RUN apk add git g++ make py3-pip
# Set work directory
WORKDIR /app
# Copy package.json from build-runner
COPY --from=build-runner /tmp/app/package.json /app/package.json
COPY --from=build-runner /tmp/app/pnpm-lock.yaml /app/pnpm-lock.yaml
# Install dependencies
RUN npm install -g pnpm
RUN pnpm install --only=production
# Move build files
COPY --from=build-runner /tmp/app/dist /app/dist
COPY --from=build-runner /tmp/app/dynamic-data /app/dynamic-data-template
# Start bot
CMD [ "cp", "-r", "dynamic-data-template", "dynamic-data", "&&", "node", "dist/main.js" ]