From 03a448bf6ded34a02e057d18d238f8a9a3ee07ce Mon Sep 17 00:00:00 2001 From: robin Date: Tue, 2 Jan 2024 01:18:58 +0800 Subject: [PATCH] Refactor Dockerfile to simplify COPY commands --- Dockerfile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 55a7d36a..e9ab9a0b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,4 @@ -FROM node:18-alpine AS runner - +FROM node:18-alpine WORKDIR /app ENV NODE_ENV production @@ -9,7 +8,7 @@ ENV NODE_ENV production RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nextjs -COPY --from=builder /app/public ./public +COPY /app/public ./public # Set the correct permission for prerender cache RUN mkdir .next @@ -17,8 +16,8 @@ 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/.next/standalone ./ -COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static +COPY --chown=nextjs:nodejs /app/.next/standalone ./ +COPY --chown=nextjs:nodejs /app/.next/static ./.next/static USER nextjs