-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
79 lines (71 loc) · 2.16 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
FROM node:18-alpine AS deps
WORKDIR /app
COPY package.json package-lock.json ./
RUN apk add --no-cache libc6-compat && npm ci
FROM node:18-alpine AS builder
WORKDIR /app
# args
ARG APP_ENV
ARG NODE_ENV
ARG MONGODB
ARG GAMMA_SERVICE_URL
ARG GRAPH_URL
ARG WALLET_CONNECT_PROJECT_ID
ARG NODE_PROVIDER_MUMBAI_URL
ARG NODE_PROVIDER_BSC_TESTNET_URL
ARG NODE_PROVIDER_OPBNB_TESTNET
ARG MAIL_CLIENT
ARG MAIL_FROM
ARG MAIL_TO
ARG MAIL_ETHEREAL_HOST
ARG MAIL_ETHEREAL_PORT
ARG MAIL_ETHEREAL_USER
ARG MAIL_ETHEREAL_PSWD
ARG MAIL_SG_KEY
ARG MAIL_SG_FROM
ARG NEXT_PUBLIC_STORAGE_URL_ALPHA
ARG NEXT_PUBLIC_STORAGE_URL_GAMMA
ARG NEXT_PUBLIC_ADMIN_ACCOUNTS
ARG NOF_VERSION
# env
ENV APP_ENV $APP_ENV
ENV NODE_ENV $NODE_ENV
ENV MONGODB $MONGODB
ENV GAMMA_SERVICE_URL $GAMMA_SERVICE_URL
ENV GRAPH_URL $GRAPH_URL
ENV WALLET_CONNECT_PROJECT_ID $WALLET_CONNECT_PROJECT_ID
ENV NODE_PROVIDER_MUMBAI_URL $NODE_PROVIDER_MUMBAI_URL
ENV NODE_PROVIDER_BSC_TESTNET_URL $NODE_PROVIDER_BSC_TESTNET_URL
ENV NODE_PROVIDER_OPBNB_TESTNET $NODE_PROVIDER_OPBNB_TESTNET
ENV MAIL_CLIENT $MAIL_CLIENT
ENV MAIL_FROM $MAIL_FROM
ENV MAIL_TO $MAIL_TO
ENV MAIL_ETHEREAL_HOST $MAIL_ETHEREAL_HOST
ENV MAIL_ETHEREAL_PORT $MAIL_ETHEREAL_PORT
ENV MAIL_ETHEREAL_USER $MAIL_ETHEREAL_USER
ENV MAIL_ETHEREAL_PSWD $MAIL_ETHEREAL_PSWD
ENV MAIL_SG_KEY $MAIL_SG_KEY
ENV MAIL_SG_FROM $MAIL_SG_FROM
ENV NEXT_PUBLIC_STORAGE_URL_ALPHA $NEXT_PUBLIC_STORAGE_URL_ALPHA
ENV NEXT_PUBLIC_STORAGE_URL_GAMMA $NEXT_PUBLIC_STORAGE_URL_GAMMA
ENV NEXT_PUBLIC_ADMIN_ACCOUNTS $NEXT_PUBLIC_ADMIN_ACCOUNTS
ENV NOF_VERSION $NOF_VERSION
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN echo "***********************"
RUN env
RUN echo "***********************"
RUN npm run build
FROM node:18-alpine AS runner
WORKDIR /app
ENV NODE_ENV production
RUN addgroup --system --gid 1001 nodejs && adduser --system --uid 1001 nextjs
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/package.json ./package.json
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
EXPOSE 3000
ENV PORT 3000
CMD ["node", "server.js"]