-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
59 lines (38 loc) · 1.22 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
53
54
55
56
57
58
59
# Modified from https://github.com/kaogeek/kaogeek-discord-bot
# ? -------------------------
# ? Builder: Complile TypeScript to JS
# ? -------------------------
FROM cafe.leomotors.me/riscv64/node-minimal:20-alpine AS builder
WORKDIR /app
COPY package.json pnpm-lock.yaml* ./
RUN corepack enable
RUN pnpm install --frozen-lockfile
# copy sources
COPY src ./src
COPY tsconfig.json ./
# compile
RUN pnpm build
# ? -------------------------
# ? Deps-prod: Obtaining node_modules that contains just production dependencies
# ? -------------------------
FROM cafe.leomotors.me/riscv64/node-minimal:20-alpine AS deps-prod
WORKDIR /app
COPY package.json pnpm-lock.yaml* ./
RUN corepack enable
RUN pnpm install --frozen-lockfile --prod
# ? -------------------------
# ? Runner: Production to run
# ? -------------------------
FROM cafe.leomotors.me/riscv64/node-minimal:20-alpine AS runner
LABEL name="bots-gulag"
RUN corepack enable
USER node
ENV NODE_ENV=production
ENV ENVIRONMENT=PRODUCTION
# copy all files from layers above
COPY package.json ./
# copy built files
COPY --chown=node:node --from=deps-prod /app/node_modules ./node_modules
COPY --chown=node:node --from=builder /app/dist ./dist
RUN pnpm --version
CMD ["pnpm", "start"]