-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Dockerfile
44 lines (31 loc) · 926 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
## build runner
FROM --platform=linux/amd64 node:20.17.0 as build-runner
# Set temp directory
WORKDIR /tmp/app
# Move package.json
COPY package*.json ./
# Install dependencies
RUN npm install
# Move source files
COPY src ./src
COPY tsconfig.json .
# Build project
RUN npm run build
## producation runner
FROM --platform=linux/amd64 node:20.17.0 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 --only=production
# Move build files
COPY --from=build-runner /tmp/app/build /app/build
# Import args from docker-compose
ARG NODE_ENV=$NODE_ENV
ARG BOT_CLIENT_ID=$BOT_CLIENT_ID
ARG BOT_TOKEN=$BOT_TOKEN
# Run deploy command
RUN NODE_ENV=${NODE_ENV} BOT_TOKEN=${BOT_TOKEN} BOT_CLIENT_ID=${BOT_CLIENT_ID} npm run update-commands
# Start bot
CMD [ "node", "build/sharding.js" ]