From a6fc79ec41297f7743069e6b5ea9f791029371c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Jane=C4=8Dek?= Date: Mon, 19 Apr 2021 10:39:13 +0200 Subject: [PATCH] examples: reduce image size in Docker example --- examples/with-docker/Dockerfile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/examples/with-docker/Dockerfile b/examples/with-docker/Dockerfile index b08d4619a839c..50a055be99d7a 100644 --- a/examples/with-docker/Dockerfile +++ b/examples/with-docker/Dockerfile @@ -19,18 +19,23 @@ 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 /app/.next ./.next +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 -RUN addgroup -g 1001 -S nodejs -RUN adduser -S nextjs -u 1001 -RUN chown -R nextjs:nodejs /app/.next USER nextjs EXPOSE 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 ["yarn", "start"]