-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
66 lines (47 loc) · 1.32 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
FROM node:20-alpine AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm ci
FROM node:20-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY tsconfig.json .
COPY postcss.config.js .
COPY tailwind.config.js .
COPY next.config.js .
COPY local.graphql .
COPY package.json package-lock.json* ./
COPY @types @types
COPY public public
COPY src src
FROM builder as development
ARG APP_FQDN
ENV NEXT_PUBLIC_APP_FQDN $APP_FQDN
ENV NODE_ENV "development"
ENV PORT 3000
EXPOSE 3000
CMD ["npm", "run", "dev"]
FROM builder AS production
ARG APP_FQDN
ENV NEXT_PUBLIC_APP_FQDN $APP_FQDN
ENV NODE_ENV "production"
RUN npm run build
FROM production AS runner
ARG APP_FQDN
ENV NEXT_PUBLIC_APP_FQDN $APP_FQDN
ENV NEXT_PUBLIC_COOKIE_CONSENT_BANNER $COOKIE_CONSENT_BANNER
ENV NEXT_PUBLIC_TERMLY_ID $TERMLY_ID
ENV PORT 3000
WORKDIR /app
RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001
COPY --from=production /app/public ./public
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=production --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=production --chown=nextjs:nodejs /app/.next/static ./.next/static
RUN chown -R nextjs:nodejs /app/.next
USER nextjs
RUN chmod +rw /app/.next
EXPOSE 3000
CMD ["node", "server.js"]