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.