Skip to content

nself build

Generate docker-compose.yml, nginx configs, and SSL certificates from .env.

nself build [flags]

nself build reads your .env cascade and generates all infrastructure configuration files: a docker-compose.yml with every enabled service, nginx reverse-proxy configs, and SSL certificates. It must be run after nself init and after any configuration change before restarting services.

The build pipeline loads configuration from .env.dev.env.{ENV}.env.secrets.env.local.env, merges plugin configurations from ~/.nself/plugins/, and applies security validation (password strength, no wildcard CORS in production, port binding checks). The result is a single docker-compose.yml that includes core services, optional services, monitoring, custom services (CS_1–CS_10), and any installed plugins.

By default, nself build is smart-cached: it compares .env modification time against docker-compose.yml and skips regeneration when nothing has changed. Use --force to override the cache.

FlagDefaultDescription
--force, -ffalseForce rebuild all components, ignore cache
--checkfalseValidate configuration only, do not write any files
--verbose, -vfalseShow environment cascade during build
--quiet, -qfalseSuppress non-error output (CI use)
--no-cachefalseDisable build cache
--debugfalseEnable debug mode
--allow-insecurefalseAllow insecure configuration (dev only)
--security-reportfalseGenerate a security analysis after build
--no-migration-checkfalseSkip v1 artifact detection (automation/CI)
--no-monorepofalseDisable automatic monorepo backend detection
--help, -hnoneShow help
Terminal window
# Standard build
nself build
# Validate config only, don't write files
nself build --check
# Force rebuild everything, ignoring cache
nself build --force
# CI mode, quiet output
nself build -q
# Show the environment cascade as it loads
nself build --verbose
# Generate a security analysis report
nself build --security-report
# Rebuild for a specific environment
nself build --force --verbose

Commands | Home