CLI Commands Reference¶
Complete reference for Airbase CLI commands
This reference provides detailed documentation for all Airbase CLI commands, their options, and usage patterns.
Installation¶
Current CLI (npm-based)¶
Version: 3.0.0-beta.15 or later
Global Options¶
These options are available for all commands:
| Option | Description |
|---|---|
--help | Display help for a command |
--version | Display CLI version |
Commands Overview¶
| Command | Description |
|---|---|
airbase login | Authenticate with Airbase |
airbase configure | Interactive project configuration |
airbase container build | Build container image |
airbase container deploy | Deploy application |
airbase container destroy | Remove deployment |
airbase login¶
Authenticate with Airbase to access deployment functionality.
Usage¶
Description¶
Opens your default browser to authenticate with Airbase. After successful authentication, stores credentials locally for subsequent commands.
Authentication Flow¶
- CLI opens browser to Airbase Console
- User logs in with government credentials
- Browser redirects back with authentication token
- CLI stores token locally
- Authentication complete
Authentication Storage¶
Credentials are stored in: - Location: ~/.airbase/credentials (or platform-specific config directory) - Format: Encrypted token file - Scope: Per-user, system-wide
Examples¶
Expected output:
Troubleshooting¶
Issue: Browser doesn't open
Try manually navigating to the authentication URL shown in the terminal.
Issue: Authentication fails
- Ensure you have access to Airbase
- Check your government credentials
- Verify network connectivity to console.airbase.tech.gov.sg
Issue: Already authenticated
Re-running airbase login will re-authenticate and overwrite existing credentials.
Exit Codes¶
| Code | Meaning |
|---|---|
| 0 | Authentication successful |
| 1 | Authentication failed |
| 2 | Network error |
airbase configure¶
Interactive configuration tool for creating or updating airbase.json.
Usage¶
Description¶
Launches an interactive prompt to configure your project. Creates or updates airbase.json in the current directory.
Interactive Prompts¶
- Project handle: Select from your available projects
- Port: Enter application listening port (default: 3000)
- Instance type: Select instance size (default: nano)
Generated File¶
Creates airbase.json:
{
"framework": "container",
"handle": "team-name/project-name",
"port": 3000,
"instanceType": "nano"
}
Examples¶
Expected interaction:
? Select your project: runtime/demo
? Port: 3000
? Instance type: nano
✓ Configuration saved to airbase.json
Notes¶
- Must be authenticated (
airbase login) before running - Overwrites existing
airbase.jsonif present - Creates file in current working directory
Exit Codes¶
| Code | Meaning |
|---|---|
| 0 | Configuration saved successfully |
| 1 | Configuration failed (user cancelled or error) |
airbase project¶
Manage Airbase projects and project linking.
airbase project link¶
⚠️ DEPRECATED - DO NOT USE
This command is deprecated and can cause deployment issues.
Use
airbase configureinstead - It's the recommended way to set up your project for deployment.
Why use airbase configure instead: - Sets up airbase.json with correct project handle - Configuration is committed to repository (team-wide) - Explicit and transparent - no hidden link files - Works seamlessly in CI/CD pipelines - Prevents deployment to wrong project
Issues with airbase project link: - Creates hidden .airbase/ directory with link file - Can cause confusion about which project is being deployed - Link file conflicts in team environments - Not portable across team members - Makes deployments implicit and harder to debug
See: airbase configure for the recommended setup workflow.
airbase project list¶
Display all projects accessible from your Airbase account.
Usage:
Description:
Lists all projects you have access to across all teams. Useful for finding project handles when running airbase configure.
Sample output:
Use cases: - Find project handles before running airbase configure - Verify access to projects - Discover available projects in your account
airbase container build¶
Build a container image from your Dockerfile.
Usage¶
Description¶
Builds a container image using Docker locally, then pushes it to the Airbase-managed container registry.
Requirements¶
- Docker must be installed and running
- Docker Buildx plugin must be installed (see below)
- Dockerfile must exist in current directory
- Must be authenticated (
airbase login) - Dockerfile must follow Airbase platform constraints (non-root user, proper ownership)
Installing Docker Buildx:
Docker Buildx is not installed by default on SEED devices or after initial Docker setup.
-
Check if Buildx is available:
-
If not installed, install it:
-
Verify installation:
Build Process¶
- Reads
Dockerfilefrom current directory - Builds image using local Docker daemon
- Tags image with Airbase-specific tag
- Pushes image to Airbase registry via API
- Image ready for deployment
Options¶
| Option | Description | Default |
|---|---|---|
-f, --file <path> | Path to Dockerfile | ./Dockerfile |
--platform <platform> | Target platform | linux/amd64 |
Examples¶
# Build with default Dockerfile
airbase container build
# Build with custom Dockerfile path
airbase container build --file docker/Dockerfile.prod
# Build for specific platform
airbase container build --platform linux/arm64
Expected Output¶
Building container...
[+] Building 45.2s (12/12) FINISHED
=> [internal] load build definition from Dockerfile
=> => transferring dockerfile: 326B
=> [internal] load .dockerignore
=> ...
✓ Build complete
✓ Image pushed to registry
Build Time¶
- First build: 2-5 minutes (downloads base images)
- Subsequent builds: 30 seconds - 2 minutes (uses cache)
Caching¶
Docker layer caching is used to speed up builds: - Base images are cached locally - Unchanged layers are reused - Only modified layers are rebuilt
Troubleshooting¶
Issue: Docker not running
Solution: Start Docker Desktop or Docker service.
Issue: Dockerfile not found
Solution: Run command from directory containing Dockerfile, or use --file flag.
Issue: Build fails
Check Dockerfile syntax and requirements. See Dockerfile Requirements.
Exit Codes¶
| Code | Meaning |
|---|---|
| 0 | Build successful |
| 1 | Build failed (Dockerfile error, Docker error) |
| 2 | Registry push failed |
airbase container deploy¶
Deploy your application to Airbase.
Usage¶
Description¶
Deploys a container image to Airbase, making your application accessible via HTTPS URL.
Arguments¶
| Argument | Description | Required |
|---|---|---|
ENVIRONMENT | Environment name (e.g., staging, development) | No (defaults to production) |
Options¶
| Option | Description | Default |
|---|---|---|
--yes | Skip confirmation prompt | - |
--project <handle> | Override project handle | From airbase.json |
--port <number> | Override port | From airbase.json |
--image <tag> | Deploy specific image tag | Last built image |
--instance-type <type> | Override instance type | From airbase.json |
--output <file> | Write deployment URL to file | - |
Examples¶
Deploy to default environment (production):
Deploy to named environment:
airbase container deploy --yes staging
airbase container deploy --yes development
airbase container deploy --yes feature-auth
Deploy with custom settings:
# Deploy specific image
airbase container deploy --yes --image myapp:v1.2.3
# Override port
airbase container deploy --yes --port 8080
# Override instance type
airbase container deploy --yes --instance-type b.small
# Write URL to file
airbase container deploy --yes --output deployment-url.txt
Redeploy without rebuilding:
Deployment Process¶
- CLI reads
airbase.jsonfor project configuration - Sends deployment request to Airbase API
- Airbase pulls container image from registry
- Deploys container to Kubernetes cluster
- Configures ingress (HTTPS endpoint)
- Application becomes accessible
Deployment Time¶
Typical: 30 seconds - 2 minutes
Output¶
Project: my-app (runtime/demo)
Environment: staging
Image: local.airbase.sg/demo:abc123
Port ($PORT): 3000
Instance Type: nano
Deployed my-app in staging (runtime/demo:staging)
Visit https://staging--demo.app.tc1.airbase.sg
⠋ Pushing image...
⠙ Saving image...
⠸ Deploying container...
⠼ Waiting for deployment...
URL Patterns¶
| Environment Type | URL Format |
|---|---|
| Default (production) | https://PROJECT-NAME.app.tc1.airbase.sg |
| Named environment | https://ENVIRONMENT--PROJECT-NAME.app.tc1.airbase.sg |
Environment Variables¶
CLI automatically reads and sends environment variables from:
.env- For default/production environment.env.ENVIRONMENT- For named environments (e.g.,.env.staging)
See Environment Variables Reference for details.
Confirmation Prompts¶
Default environment (production): - Prompt defaults to "N" (requires explicit confirmation) - Use --yes flag to skip prompt
Named environments: - Prompt defaults to "Y" (easier iteration) - Use --yes flag to skip prompt
Troubleshooting¶
Issue: Project handle not found
Solution: Verify handle in airbase.json matches your project in Airbase Console.
Issue: Port mismatch
Application doesn't respond after deployment.
Solution: Ensure port in airbase.json matches the port your application listens on.
Issue: Image not found
Solution: Run airbase container build first.
Issue: Deployment timeout
Solution: Check application logs in Airbase Console. Application may be crashing on startup.
Exit Codes¶
| Code | Meaning |
|---|---|
| 0 | Deployment successful |
| 1 | Deployment failed (configuration error) |
| 2 | API error |
| 3 | Timeout |
airbase container destroy¶
Remove a deployment from Airbase.
Usage¶
Description¶
Removes your application from the specified environment, freeing resources and making the URL inaccessible.
Arguments¶
| Argument | Description | Required |
|---|---|---|
ENVIRONMENT | Environment name | No (defaults to production) |
Options¶
| Option | Description |
|---|---|
--yes | Skip confirmation prompt |
--project <handle> | Override project handle |
Examples¶
Undeploy from default environment:
Undeploy from named environment:
airbase container destroy --yes staging
airbase container destroy --yes development
airbase container destroy --yes feature-auth
Destruction Process¶
- CLI sends destroy request to Airbase API
- Airbase removes Kubernetes deployment
- Ingress (HTTPS endpoint) is removed
- Resources are freed
- URL becomes inaccessible
Propagation Time¶
Wait 30-60 seconds for changes to fully propagate across the infrastructure.
Output¶
Verification¶
After undeployment, verify URL is inaccessible:
# Wait for propagation
sleep 60
# Check URL (should fail)
curl -I https://staging--myproject.app.tc1.airbase.sg
Expected: Connection error or 404 response.
Confirmation Prompts¶
Default environment (production): - Prompt defaults to "N" (protection against accidental deletion) - Use --yes flag to skip prompt
Named environments: - Prompt defaults to "Y" (easier cleanup) - Use --yes flag to skip prompt
Important Notes¶
- Destructive operation: Cannot be undone
- No data loss: Container images remain in registry
- Redeployable: Can redeploy anytime with
airbase container deploy - Environment-specific: Only removes from specified environment
Troubleshooting¶
Issue: Environment not found
Solution: Verify environment name and that application is deployed there.
Issue: URL still accessible after destroy
Solution: Wait 30-60 seconds for propagation. If still accessible after 2 minutes, check Airbase Console.
Exit Codes¶
| Code | Meaning |
|---|---|
| 0 | Undeployment successful |
| 1 | Undeployment failed |
| 2 | API error |
Common Command Patterns¶
First-Time Deployment Workflow¶
# Step 1: Authenticate
airbase login
# Step 2: Configure project
airbase configure
# Step 3: Build container
airbase container build
# Step 4: Deploy to production
airbase container deploy --yes
Development Workflow¶
# Make code changes...
# Rebuild
airbase container build
# Deploy to staging
airbase container deploy --yes staging
# Test at staging URL...
# If good, deploy to production
airbase container deploy --yes
Multi-Environment Deployment¶
# Build once
airbase container build
# Deploy to all environments
airbase container deploy --yes development
airbase container deploy --yes staging
airbase container deploy --yes production
Cleanup Workflow¶
# Remove feature environment
airbase container destroy --yes feature-auth
# Remove staging
airbase container destroy --yes staging
Exit Codes Summary¶
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error (validation, user error) |
| 2 | Network/API error |
| 3 | Timeout |
| 130 | User cancelled (Ctrl+C) |
Configuration Files¶
airbase.json¶
CLI reads configuration from airbase.json in the current directory.
Required fields: - framework: Must be "container" - handle: Project identifier (format: team-name/project-name) - port: Application listening port
Optional fields: - instanceType: Instance size (default: "nano")
See airbase.json Reference for complete specification.
Environment Variables Files¶
CLI reads environment variables from .env files:
.env- Default/production environment.env.staging- Staging environment.env.development- Development environment.env.ENVIRONMENT- Custom environment
See Environment Variables Reference for complete specification.
Error Messages¶
Authentication Errors¶
Solution: Run airbase login to authenticate.
Configuration Errors¶
Solution: Create airbase.json or run airbase configure.
Solution: Handle must be in format team-name/project-name.
Build Errors¶
Solution: Start Docker Desktop or Docker service.
Solution: Ensure Dockerfile exists or use --file flag.
Deployment Errors¶
Solution: Verify project handle in Airbase Console.
Solution: Use valid port number in airbase.json.
Solution: Run airbase container build first.
Network Errors¶
Solution: Check network connectivity, verify access to console.airbase.tech.gov.sg.
Solution: Retry command. If persists, check Airbase status.
Environment Variables (CLI Behavior)¶
CLI behavior can be modified with environment variables:
| Variable | Description | Default |
|---|---|---|
AIRBASE_CONFIG_PATH | Custom path to credentials | ~/.airbase |
DOCKER_HOST | Docker daemon socket | Platform default |
NO_COLOR | Disable colored output | - |
Examples¶
# Use custom config path
export AIRBASE_CONFIG_PATH=/path/to/config
airbase login
# Connect to remote Docker daemon
export DOCKER_HOST=tcp://remote-host:2375
airbase container build
# Disable colors (CI/CD)
export NO_COLOR=1
airbase container deploy --yes
CI/CD Usage¶
CLI is designed for automation in CI/CD pipelines.
GitHub Actions Example¶
name: Deploy to Airbase
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Airbase CLI
run: npm install -g @airbase/airbase-cli@containers
- name: Authenticate
run: airbase login
env:
AIRBASE_TOKEN: ${{ secrets.AIRBASE_TOKEN }}
- name: Build
run: airbase container build
- name: Deploy
run: airbase container deploy --yes
Authentication in CI/CD¶
Use AIRBASE_TOKEN environment variable to authenticate non-interactively:
Platform-Specific Notes¶
macOS¶
- Credentials stored in:
~/Library/Application Support/airbase/ - Docker typically via Docker Desktop
- Browser: Opens default browser for authentication
Linux¶
- Credentials stored in:
~/.config/airbase/ - Docker via Docker Engine or Docker Desktop
- Browser: Uses
xdg-opento launch browser
Windows¶
- Credentials stored in:
%APPDATA%\airbase\ - Docker typically via Docker Desktop
- Browser: Opens default browser for authentication
Version History¶
Current: 3.0.0-beta.15¶
- Initial container deployment support
- Commands: login, configure, build, deploy, destroy
- Environment support
- Environment variables support
See Also¶
- How-To: Build and Deploy Applications
- How-To: Manage Environments
- Reference: Dockerfile Requirements
- Reference: airbase.json Configuration
- Reference: Environment Variables
- Tutorial: Getting Started