From 6279bd4f318d313ae9d2ce8ae393cd88a3286ff3 Mon Sep 17 00:00:00 2001 From: null Date: Tue, 19 May 2026 21:57:38 -0500 Subject: [PATCH] =?UTF-8?q?feat(docker):=20standalone=20output=20for=20sli?= =?UTF-8?q?m=20frontend=20image=20(886MB=20=E2=86=92=20219MB)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/Dockerfile | 16 ++++++---------- frontend/next.config.ts | 1 + 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 09bf681..f9fd026 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -32,19 +32,15 @@ ENV NEXT_PUBLIC_API_URL=auto ENV NEXT_PUBLIC_AUTH_MODE=${NEXT_PUBLIC_AUTH_MODE} # Create non-root user before COPY so --chown can reference it. -# Using COPY --chown avoids a slow recursive chown on overlay2 (docker/for-linux#388). -RUN addgroup -S appgroup && adduser -S -G appgroup appuser \ - && chown appuser:appgroup /app +RUN addgroup -S appgroup && adduser -S -G appgroup appuser -COPY --from=builder --chown=appuser:appgroup /app/.next ./.next -# `public/` is optional in Next.js apps; repo may not have it. -# Avoid failing the build when the directory is absent. -COPY --from=builder --chown=appuser:appgroup /app/package.json ./package.json -COPY --from=builder --chown=appuser:appgroup /app/node_modules ./node_modules -COPY --from=builder --chown=appuser:appgroup /app/next.config.ts ./next.config.ts +# Copy standalone output from builder +COPY --from=builder --chown=appuser:appgroup /app/.next/standalone ./ +COPY --from=builder --chown=appuser:appgroup /app/.next/static ./.next/static +COPY --from=builder --chown=appuser:appgroup /app/public ./public USER appuser EXPOSE 3000 -CMD ["npm", "run", "start"] +CMD ["node", "server.js"] \ No newline at end of file diff --git a/frontend/next.config.ts b/frontend/next.config.ts index 8c034bc..b57d8a8 100644 --- a/frontend/next.config.ts +++ b/frontend/next.config.ts @@ -1,6 +1,7 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { + output: "standalone", // In dev, Next may proxy requests based on the request origin/host. // Allow common local origins so `next dev --hostname 127.0.0.1` works // when users access via http://localhost:3000 or http://127.0.0.1:3000.