diff --git a/Dockerfile b/Dockerfile index 997ff97..4f60c89 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,9 +24,17 @@ RUN npm run build || (test -d .next && echo "Build completed with SSR warnings ( FROM node:20-alpine AS runner WORKDIR /app ENV NODE_ENV=production -COPY --from=builder /app/.next .next + +# Copy standalone server and dependencies +COPY --from=builder /app/.next/standalone ./ +COPY --from=builder /app/.next/static ./.next/static COPY --from=builder /app/public ./public -COPY --from=builder /app/package*.json ./ -COPY --from=builder /app/node_modules ./node_modules + +# Set environment variables at runtime +ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL +ENV NEXT_PUBLIC_FRONTEND_URL=$NEXT_PUBLIC_FRONTEND_URL +ENV NEXT_PUBLIC_GOOGLE_CLIENT_ID=$NEXT_PUBLIC_GOOGLE_CLIENT_ID +ENV NEXT_PUBLIC_FACEBOOK_APP_ID=$NEXT_PUBLIC_FACEBOOK_APP_ID + EXPOSE 3000 -CMD ["npm", "run", "start"] +CMD ["node", "server.js"] diff --git a/next.config.js b/next.config.js index e5b6a48..b411d4e 100644 --- a/next.config.js +++ b/next.config.js @@ -1,6 +1,7 @@ /** @type {import('next').NextConfig} */ const nextConfig = { reactStrictMode: true, + output: 'standalone', env: { NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL, }, @@ -11,7 +12,10 @@ const nextConfig = { eslint: { ignoreDuringBuilds: false, }, - // si tu as des rewrites ou redirections, vérifie aussi + // Skip static page generation errors for client-only pages + experimental: { + missingSuspenseWithCSRBailout: false, + }, }; module.exports = nextConfig;