-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (27 loc) · 1020 Bytes
/
Copy pathDockerfile
File metadata and controls
41 lines (27 loc) · 1020 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
34
35
36
37
38
39
40
41
# Build layer
FROM node:22-alpine AS build
RUN corepack enable && corepack prepare pnpm@9.15.4 --activate
COPY . /build
WORKDIR /build
COPY package.json ./
COPY pnpm-lock.yaml ./
RUN --mount=type=cache,id=pnpm,target=/root/.local/share/pnpm/store pnpm fetch --frozen-lockfile
RUN --mount=type=cache,id=pnpm,target=/root/.local/share/pnpm/store pnpm install --frozen-lockfile
ARG DATABASE_URL
ENV DATABASE_URL=$DATABASE_URL
ARG SKIP_MIGRATE
ENV SKIP_MIGRATE=$SKIP_MIGRATE
RUN pnpm prisma generate
RUN [ "$SKIP_MIGRATE" != "true" ] && pnpm prisma migrate deploy || echo "Skipping migration"
RUN pnpm run build
RUN pnpm prune --prod --ignore-scripts
# Package layer
FROM node:22-alpine AS package
RUN apk --no-cache add curl file ffmpeg
WORKDIR /bot
COPY --from=build /build/dist dist
COPY --from=build /build/node_modules node_modules
COPY --from=build /build/prisma prisma
COPY --from=build /build/package.json package.json
CMD ["node", "dist/index.js"]
EXPOSE 3000