This example demonstrates how to set up and use the Inference Gateway UI with Authentication enabled using Docker Compose.
- Docker Engine 24.0+
- Docker Compose 2.20+
- Valid OAuth credentials from your provider(s)
- Copy environment templates:
cp .env.backend.example .env.backend
cp .env.frontend.example .env.frontend- Configure backend environment (.env.backend):
AUTH_ENABLED=true
OIDC_ISSUER_URL=http://localhost:8080/realms/app-realm
OIDC_CLIENT_ID=app-client
OIDC_CLIENT_SECRET=very-secret- Configure frontend environment (.env.frontend):
AUTH_ENABLED="true"
SECURE_COOKIES=false # Set to true if you are using HTTPS for production
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=very-secret
NEXTAUTH_TRUST_HOST=true
# Keycloak Configuration
KEYCLOAK_ISSUER=http://localhost:8080/realms/app-realm
KEYCLOAK_ID=app-client
KEYCLOAK_SECRET=very-secret- Start the services:
docker compose -f docker-compose.yaml up- Add additional OAuth providers by following the NextAuth.js documentation
- For production deployments:
- Set
NEXTAUTH_URLto your public domain - Enable HTTPS
- Use proper secret management
- Configure session storage
- Set
View container logs:
docker compose -f examples/docker-compose/authentication/docker-compose.yaml logs -f