Configure backend API endpoint for Docker deployments

This commit is contained in:
Daniel Alves Rösel
2026-04-02 22:30:03 +04:00
committed by GitHub
2 changed files with 5 additions and 2 deletions

View File

@@ -38,7 +38,8 @@ LOGDIR="/tmp/logs-$NAME/"
NEXT_PUBLIC_REQUIRE_AUTH=false NEXT_PUBLIC_REQUIRE_AUTH=false
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=your_supabase_anon_key_here NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=your_supabase_anon_key_here
NEXT_PUBLIC_API_BASE_URL=http://localhost:9812 # Server-side proxy target (read by next.config.ts at runtime, not baked into the bundle)
API_BASE_URL=http://localhost:9812
# MinIO Object Storage (used instead of S3) # MinIO Object Storage (used instead of S3)
MINIO_ROOT_USER=minioadmin MINIO_ROOT_USER=minioadmin

View File

@@ -4,7 +4,9 @@ import path from "node:path";
const nextConfig: NextConfig = { const nextConfig: NextConfig = {
outputFileTracingRoot: path.join(process.cwd(), "../.."), outputFileTracingRoot: path.join(process.cwd(), "../.."),
async rewrites() { async rewrites() {
const backend = process.env.API_BASE_URL ?? "http://localhost:9812"; // In Docker (Dokploy/compose) the backend container is always reachable at cvfs-backend:8080.
// Override with API_BASE_URL for local dev (e.g. http://localhost:9812).
const backend = process.env.API_BASE_URL ?? "http://cvfs-backend:8080";
return [{ source: "/api/:path*", destination: `${backend}/api/:path*` }]; return [{ source: "/api/:path*", destination: `${backend}/api/:path*` }];
}, },
}; };