2021-12-14 23:00:41 +01:00
|
|
|
# From https://nextjs.org/docs/deployment
|
|
|
|
|
|
|
|
# Rebuild the source code only when needed
|
2022-10-20 22:11:04 +02:00
|
|
|
FROM node:lts-alpine AS builder
|
2021-12-14 23:00:41 +01:00
|
|
|
RUN apk add --no-cache libc6-compat
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package.json package-lock.json ./
|
|
|
|
RUN npm ci
|
|
|
|
COPY . .
|
2022-03-09 12:13:33 +01:00
|
|
|
ENV NEXT_TELEMETRY_DISABLED 1
|
2021-12-14 23:00:41 +01:00
|
|
|
RUN npm run build
|
|
|
|
|
|
|
|
# Production image, copy all the files and run next
|
2022-10-20 22:11:04 +02:00
|
|
|
FROM node:lts-alpine AS runner
|
2021-12-14 23:00:41 +01:00
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
ENV NODE_ENV production
|
|
|
|
|
|
|
|
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 /app/next.config.js ./
|
|
|
|
COPY --from=builder /app/public ./public
|
|
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
|
|
|
|
COPY --from=builder /app/node_modules ./node_modules
|
|
|
|
COPY --from=builder /app/package.json ./package.json
|
|
|
|
|
|
|
|
USER nextjs
|
|
|
|
|
|
|
|
EXPOSE 3000
|
|
|
|
|
|
|
|
ENV PORT 3000
|
|
|
|
|
|
|
|
# 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 ["node_modules/.bin/next", "start"]
|