diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 31d71243..6becd3ae 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -62,7 +62,7 @@ CMD ["npm", "run", "dev", "--", "-p", "8080"] # Production image, copy all the files and run next FROM base AS production -WORKDIR /app/frontend +WORKDIR /app ENV NODE_ENV=production # Uncomment the following line in case you want to disable telemetry during runtime. @@ -71,18 +71,17 @@ ENV NEXT_TELEMETRY_DISABLED 1 RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nextjs +# Automatically leverage output traces to reduce image size +# https://nextjs.org/docs/advanced-features/output-file-tracing +COPY --from=builder --chown=nextjs:nodejs /app/frontend/.next/standalone/frontend ./ +COPY --from=builder --chown=nextjs:nodejs /app/frontend/.next/static ./.next/static + COPY --from=builder /app/node_modules ./node_modules COPY --from=builder /app/frontend/public ./public # Set the correct permission for prerender cache -RUN mkdir .next RUN chown nextjs:nodejs .next -# Automatically leverage output traces to reduce image size -# https://nextjs.org/docs/advanced-features/output-file-tracing -COPY --from=builder --chown=nextjs:nodejs /app/frontend/.next/standalone ./ -COPY --from=builder --chown=nextjs:nodejs /app/frontend/.next/static ./.next/static - USER nextjs EXPOSE 8080