-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdockerfile
52 lines (40 loc) · 1.26 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
49
50
51
52
ARG NODE_VERSION=20.12
FROM node:${NODE_VERSION}-bookworm-slim as base
RUN apt-get update && \
apt-get install -y python3 make build-essential ffmpeg ca-certificates &&\
apt-get clean &&\
apt-get purge -y --auto-remove && \
rm -rf /var/lib/apt/lists/*
WORKDIR /vilbot
FROM base as build
COPY . .
RUN npm ci
RUN npm run build
RUN rm -rf node_modules && \
npm ci --omit=dev
FROM base as prod
ENV DISCORD_TOKEN=empty
ENV CLIENT_ID=empty
ENV CONNECTION_DB=empty
ENV SOCKET_URL=empty
ENV JWT_SECRET_KEY=empty
ENV DB_URI=mongodb://mongoDB/vilbot_db
ENV DB_NAME=vilbot
ENV GUILD_ID=12345
COPY package*.json ./
COPY --from=build /vilbot/node_modules ./node_modules
COPY --from=build /vilbot/dist ./dist
RUN echo "APP_NAME=vilbot" >> .env && \
echo "APP_ENV=production" >> .env && \
echo "DISCORD_TOKEN=${DISCORD_TOKEN}" >> .env && \
echo "CLIENT_ID=${CLIENT_ID}" >> .env && \
echo "GUILD_ID=${GUILD_ID}" >> .env && \
echo "DB_URI=${DB_URI}" >> .env && \
echo "DB_NAME=${DB_NAME}" >> .env && \
echo "SOCKET_URL=${SOCKET_URL}" >> .env && \
echo "JWT_SECRET_KEY=${JWT_SECRET_KEY}" >> .env
RUN apt-get purge -y python3 && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
CMD ["npm", "run", "start"]