-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
43 lines (31 loc) · 1.07 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
FROM node:alpine AS builder
WORKDIR /opt/app
COPY ./ ./
RUN npm install
RUN npm run build
CMD ["npm", "run", "start"]
FROM node:alpine AS runner
WORKDIR /opt/app
ARG APP_ENV=productiongiy
ARG NODE_ENV=production
ARG PORT=3000
ENV APP_ENV=${APP_ENV} \
NODE_ENV=${NODE_ENV} \
PORT=${PORT} \
# This allows to access Graphql Playground
APOLLO_PRODUCTION_INTROSPECTION=false
RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001
# You only need to copy next.config.js if you are NOT using the default configuration
COPY --from=builder /opt/app/next.config.js ./
COPY --from=builder /opt/app/public ./public
COPY --from=builder --chown=nextjs:nodejs /opt/app/.next ./.next
COPY --from=builder /opt/app/node_modules ./node_modules
COPY --from=builder /opt/app/package.json ./package.json
USER nextjs
EXPOSE ${PORT}
# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry.
# ENV NEXT_TELEMETRY_DISABLED 1
CMD ["npm", "run", "start"]