-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathDockerfile
66 lines (53 loc) · 1.39 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
60
61
62
63
64
65
66
# Install dependencies only when needed
FROM node:lts AS deps
ARG GITHUB_ID
ARG GITHUB_SECRET
ARG DATABASE_URL
ARG ADMIN_SECRET
ARG DISCORD_WEBHOOK_URL
ENV GITHUB_ID $GITHUB_ID
ENV GITHUB_SECRET $GITHUB_SECRET
ENV DATABASE_URL $DATABASE_URL
ENV ADMIN_SECRET $ADMIN_SECRET
ENV DISCORD_WEBHOOK_URL $DISCORD_WEBHOOK_URL
WORKDIR /app
COPY package.json package-lock.json schema.prisma ./
COPY migrations ./migrations
RUN npm ci
RUN npm run deploy-db
# Rebuild the source code only when needed
FROM node:lts AS builder
ARG GITHUB_ID
ARG GITHUB_SECRET
ARG DATABASE_URL
ARG ADMIN_SECRET
ARG DISCORD_WEBHOOK_URL
ENV GITHUB_ID $GITHUB_ID
ENV GITHUB_SECRET $GITHUB_SECRET
ENV DATABASE_URL $DATABASE_URL
ENV ADMIN_SECRET $ADMIN_SECRET
ENV DISCORD_WEBHOOK_URL $DISCORD_WEBHOOK_URL
WORKDIR /app
COPY . .
COPY --from=deps /app/node_modules ./node_modules
RUN npm run build
# Production image, copy all the files and run next
FROM node:lts AS runner
ARG GITHUB_ID
ARG GITHUB_SECRET
ARG DATABASE_URL
ARG ADMIN_SECRET
ARG DISCORD_WEBHOOK_URL
ENV GITHUB_ID $GITHUB_ID
ENV GITHUB_SECRET $GITHUB_SECRET
ENV DATABASE_URL $DATABASE_URL
ENV ADMIN_SECRET $ADMIN_SECRET
ENV DISCORD_WEBHOOK_URL $DISCORD_WEBHOOK_URL
WORKDIR /app
COPY --from=builder /app/public ./public
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist
ENV HOST=0.0.0.0
ENV PORT=4321
EXPOSE 4321
CMD node ./dist/server/entry.mjs