-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (23 loc) · 720 Bytes
/
Dockerfile
File metadata and controls
33 lines (23 loc) · 720 Bytes
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
# use the official Node.js 18 image as a base
FROM node:18-alpine AS builder
# set the working directory inside the container
WORKDIR /app
# copy package.json and package-lock.json first (for efficient caching)
COPY package.json ./
# install dependencies
RUN npm install
# copy the rest of the bot's source code
COPY . .
# run the build process
RUN npm run build
# production stage
FROM node:18-alpine
# set working directory
WORKDIR /app
# copy only the built files and production dependencies from the builder stage
COPY --from=builder /app/package*.json ./
RUN npm install --production
# copy only the built output
COPY --from=builder /app/dist ./dist
# command to run the bot
CMD ["node", "dist/index.js"]