diff --git a/.env.example b/.env.example index 227d7d00b..4daa6ef54 100644 --- a/.env.example +++ b/.env.example @@ -30,3 +30,7 @@ FIRECRAWL_API_KEY="" # For research, self-host or use cloud-version @ https://fi TRUST_APP_URL="http://localhost:3008" # Trust portal public site for NDA signing and access requests AUTH_TRUSTED_ORIGINS=http://localhost:3000,https://*.trycomp.ai,http://localhost:3002 + +# Set to 'true' when self-hosting to disable Next.js image optimization +# Required for Docker/self-hosted deployments where image optimization isn't available +SELF_HOSTING=false diff --git a/SELF_HOSTING.md b/SELF_HOSTING.md index 96c1ba4c3..ad4f6118a 100644 --- a/SELF_HOSTING.md +++ b/SELF_HOSTING.md @@ -26,6 +26,7 @@ For a functional deployment: - **Email**: `RESEND_API_KEY` in app and portal - **Workflows**: `TRIGGER_SECRET_KEY` in app - **Misc**: `REVALIDATION_SECRET`, `NEXT_PUBLIC_PORTAL_URL` in app +- **Images**: `SELF_HOSTING=true` in app (disables Next.js image optimization for self-hosted deployments) ### Prerequisites diff --git a/apps/app/next.config.ts b/apps/app/next.config.ts index ab6dc8956..4f7511e57 100644 --- a/apps/app/next.config.ts +++ b/apps/app/next.config.ts @@ -56,6 +56,9 @@ const config: NextConfig = { hostname: '**', }, ], + // Disable image optimization for self-hosted deployments + // where Next.js image optimization isn't available + unoptimized: process.env.SELF_HOSTING === 'true', }, experimental: { diff --git a/apps/app/src/env.mjs b/apps/app/src/env.mjs index 493db7973..7565602a1 100644 --- a/apps/app/src/env.mjs +++ b/apps/app/src/env.mjs @@ -46,6 +46,7 @@ export const env = createEnv({ NOVU_API_KEY: z.string().optional(), INTERNAL_API_TOKEN: z.string().optional(), STRIPE_SECRET_KEY: z.string().optional(), + SELF_HOSTING: z.string().transform((val) => val === 'true').optional().default('false'), }, client: {