generated from DTS-STN/next-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
91 lines (69 loc) · 2.04 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
FROM node:18.7-alpine3.15 AS base
WORKDIR /base
COPY package*.json ./
RUN npm ci
COPY . .
FROM base AS build
# Build Envs
ARG NEXT_BUILD_DATE
ENV NEXT_PUBLIC_BUILD_DATE=$NEXT_BUILD_DATE
ARG NEXT_PUBLIC_ADOBE_ANALYTICS_URL
ENV NEXT_PUBLIC_ADOBE_ANALYTICS_URL=$NEXT_PUBLIC_ADOBE_ANALYTICS_URL
ARG NEXT_CONTENT_API
ENV NEXT_CONTENT_API=$NEXT_CONTENT_API
ENV NODE_ENV=production
WORKDIR /build
COPY --from=base /base ./
RUN npm run build
FROM node:18.7-alpine3.15 AS production
ENV NODE_ENV=production
SHELL ["/bin/sh", "-c"]
RUN apk add --no-cache bash
ARG user=joker
ARG home=/home/node
ARG group=thejokers
RUN addgroup -S $group
RUN adduser \
--disabled-password \
--gecos "" \
--home $home \
--ingroup $group \
$user
ENV NODE_ENV=production
WORKDIR $home
COPY --from=build --chown=55:$group /build/next.config.js ./
COPY --from=build --chown=55:$group /build/package*.json ./
COPY --from=build --chown=55:$group /build/.next ./.next
COPY --from=build --chown=55:$group /build/public ./public
RUN VERSION_NEXT=`node -p -e "require('./package.json').dependencies.next"`&& npm install --no-package-lock --no-save next@"$VERSION_NEXT"
USER $user
# Runtime Envs
ARG OCP_APIM_SUBSCRIPTION_KEY
ENV OCP_APIM_SUBSCRIPTION_KEY=$OCP_APIM_SUBSCRIPTION_KEY
ARG CPP_ACTIVE_BENEFIT_URL
ENV CPP_ACTIVE_BENEFIT_URL=$CPP_ACTIVE_BENEFIT_URL
ARG EI_ACTIVE_BENEFIT_URL
ENV EI_ACTIVE_BENEFIT_URL=$EI_ACTIVE_BENEFIT_URL
ARG NEXTAUTH_SECRET
ENV NEXTAUTH_SECRET=$NEXTAUTH_SECRET
ARG NEXTAUTH_URL
ENV NEXTAUTH_URL=$NEXTAUTH_URL
ARG CLIENT_SECRET
ENV CLIENT_SECRET=$CLIENT_SECRET
ARG CLIENT_ID
ENV CLIENT_ID=$CLIENT_ID
ARG AUTH_ECAS_WELL_KNOWN
ENV AUTH_ECAS_WELL_KNOWN=$AUTH_ECAS_WELL_KNOWN
ARG AUTH_ECAS_AUTHORIZATION
ENV AUTH_ECAS_AUTHORIZATION=$AUTH_ECAS_AUTHORIZATION
ARG AUTH_ECAS_TOKEN
ENV AUTH_ECAS_TOKEN=$AUTH_ECAS_TOKEN
ARG AUTH_ECAS_USERINFO
ENV AUTH_ECAS_USERINFO=$AUTH_ECAS_USERINFO
ARG AUTH_PRIVATE
ENV AUTH_PRIVATE=$AUTH_PRIVATE
ARG AUTH_DISABLED
ENV AUTH_DISABLED=$AUTH_DISABLED
ARG NEXT_CONTENT_API
ENV NEXT_CONTENT_API=$NEXT_CONTENT_API
CMD npm run start