-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dbot
More file actions
40 lines (29 loc) · 1.28 KB
/
Copy pathDockerfile.dbot
File metadata and controls
40 lines (29 loc) · 1.28 KB
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
FROM node:22-alpine AS builder
WORKDIR /app
# Install pnpm globally
RUN npm install -g pnpm
# Copy lockfiles and package.json files first for better layer caching
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY apps/api/package.json ./apps/api/
COPY apps/dashboard-client/package.json ./apps/dashboard-client/
COPY apps/discord-bot/package.json ./apps/discord-bot/
COPY packages/ ./packages/
# Use BuildKit cache mount for pnpm store to speed up repeated installs
# Note: We don't mount node_modules as cache because turbo needs it for the build step
RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store \
pnpm install --frozen-lockfile
# Copy rest of source and build in the builder stage
COPY . .
RUN pnpm run build:bot
# Runtime image: smaller, only copy build artifacts
FROM node:22-alpine AS runtime
WORKDIR /app
# Optionally install pnpm or use node directly. If you need pnpm for starting, install it.
RUN npm install -g pnpm
RUN npm install -g tsdown
# Copy built files and production node_modules from builder
COPY --from=builder /app/apps/discord-bot/dist ./apps/discord-bot/dist
COPY --from=builder /app/node_modules ./node_modules
ENV NODE_ENV=production
# Replace with your production start command (adjust path/script)
CMD ["node", "apps/discord-bot/dist/index.js"]