-
Notifications
You must be signed in to change notification settings - Fork 0
/
website.Dockerfile
56 lines (31 loc) · 934 Bytes
/
website.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
FROM node:20-alpine AS base
# TODO whats this?
RUN apk add --no-cache gcompat
WORKDIR /app
FROM base AS development
COPY . .
RUN npm install
RUN npx prisma generate
EXPOSE 3000
CMD ["npm", "run", "next-dev"]
FROM base AS dependencies
COPY package.json package-lock.json ./
RUN npm ci
FROM base AS builder
ENV NODE_ENV=production
# Code contains url using this environment variable and gets type checked.
ENV BASE_URL=http://example.com/
COPY . .
COPY --from=dependencies /app/node_modules ./node_modules
RUN npx prisma generate
RUN npm run build
FROM base AS production
ENV NODE_ENV=production
EXPOSE 3000
COPY --from=builder /app/next.config.mjs ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/package.json /app/package-lock.json ./
COPY --from=builder /app/prisma ./prisma
COPY --from=builder /app/node_modules ./node_modules
CMD ["npm", "start"]