-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
90 lines (87 loc) · 2.77 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
FROM node:18-alpine AS deps
WORKDIR /app
COPY package.json yarn.lock ./
RUN apk add --no-cache libc6-compat bash curl && \
curl -o- -L https://yarnpkg.com/install.sh | bash && \
export PATH="$PATH:$(yarn global bin)" && \
yarn install --frozen-lockfile
#
FROM node:18-alpine AS builder
WORKDIR /app
#
# args
ARG APP_ENV
ARG MONGODB
ARG MONGODB_BOT
ARG DB_CHATTERPAY_NAME
ARG BOT_API_TOKEN
ARG BOT_API_URL
ARG BOT_API_WAPP_ENABLED
ARG BACKEND_API_URL
ARG BACKEND_API_TOKEN
ARG BACKEND_API_TOKEN_SECRET
ARG NODE_PROVIDER_SEPOLIA_URL
ARG NODE_PROVIDER_MUMBAI_URL
ARG NODE_PROVIDER_SCROLL_URL
ARG HANDLE_VERCEL_FREE_PLAN_TIMEOUT
ARG API3_ENABLED
ARG JWT_SECRET
ARG NEXT_PUBLIC_FROM_ICP
ARG NEXT_PUBLIC_USE_MOCK
ARG NEXT_PUBLIC_UI_URL
ARG NEXT_PUBLIC_ALLOWED_ORIGINS
ARG RECAPTCHA_API_KEY
ARG NEXT_PUBLIC_RECAPTCHA_SITE_KEY
ARG NEXT_PUBLIC_NFT_IMAGE_REPOSITORY
ARG NEXT_PUBLIC_NFT_MARKETPLACE_URL
#
# env
ENV NODE_ENV production
ENV APP_ENV $APP_ENV
ENV MONGODB $MONGODB
ENV MONGODB_BOT $MONGODB_BOT
ENV DB_CHATTERPAY_NAME $DB_CHATTERPAY_NAME
ENV BOT_API_TOKEN $BOT_API_TOKEN
ENV BOT_API_URL $BOT_API_URL
ENV BOT_API_WAPP_ENABLED $BOT_API_WAPP_ENABLED
ENV BACKEND_API_URL $BACKEND_API_URL
ENV BACKEND_API_TOKEN $BACKEND_API_TOKEN
ENV BACKEND_API_TOKEN_SECRET $BACKEND_API_TOKEN_SECRET
ENV NODE_PROVIDER_SEPOLIA_URL $NODE_PROVIDER_SEPOLIA_URL
ENV NODE_PROVIDER_MUMBAI_URL $NODE_PROVIDER_MUMBAI_URL
ENV NODE_PROVIDER_SCROLL_URL $NODE_PROVIDER_SCROLL_URL
ENV HANDLE_VERCEL_FREE_PLAN_TIMEOUT $HANDLE_VERCEL_FREE_PLAN_TIMEOUT
ENV API3_ENABLED $API3_ENABLED
ENV JWT_SECRET $JWT_SECRET
ENV NEXT_PUBLIC_FROM_ICP $NEXT_PUBLIC_FROM_ICP
ENV NEXT_PUBLIC_USE_MOCK $NEXT_PUBLIC_USE_MOCK
ENV NEXT_PUBLIC_UI_URL $NEXT_PUBLIC_UI_URL
ENV NEXT_PUBLIC_ALLOWED_ORIGINS $NEXT_PUBLIC_ALLOWED_ORIGINS
ENV RECAPTCHA_API_KEY $RECAPTCHA_API_KEY
ENV NEXT_PUBLIC_RECAPTCHA_SITE_KEY $NEXT_PUBLIC_RECAPTCHA_SITE_KEY
ENV NEXT_PUBLIC_NFT_IMAGE_REPOSITORY $NEXT_PUBLIC_NFT_IMAGE_REPOSITORY
ENV NEXT_PUBLIC_NFT_MARKETPLACE_URL $NEXT_PUBLIC_NFT_MARKETPLACE_URL
#
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN echo "***********************"
RUN env
RUN echo $BACKEND_API_TOKEN
RUN echo $BACKEND_API_TOKEN_SECRET
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"]