What are Prebuilds?
A prebuild creates an environment and runs your Dev Container build process, lifecycle hooks (onCreateCommand and updateContentCommand), and automation tasks configured with the prebuild trigger. Once these commands complete successfully, Ona takes a snapshot of the entire Dev Container filesystem. When you create a new environment from a project with prebuilds, it starts from this snapshot, skipping the time-consuming setup steps.
Using Prebuilds
When you create an environment, Ona automatically uses a prebuild if one is available. The selection uses a best-effort approach:- Matches your environment class (CPU, memory, storage)
- Uses the most recent successful prebuild
- Prebuilds are deleted after 7 days
What Gets Executed
During prebuild creation, Ona runs:- Dev Container build: Builds your Dev Container image from the Dockerfile or docker-compose configuration. Prebuilds make use of and populate the Dev Container image cache, which can significantly speed up subsequent builds.
-
Dev Container lifecycle commands:
initializeCommand- Runs before the container is createdonCreateCommand- Runs when the container is created for the first timeupdateContentCommand- Runs when the container is created or updated
-
Automation tasks: Any tasks in your
automations.yamlconfigured with theprebuildtrigger. Organization and project secrets are available during these tasks, but user secrets are not.
What Doesn’t Run
The following commands are not executed during prebuilds, as they’re intended to run when a user connects to the environment:postCreateCommand- Runs after the container is createdpostStartCommand- Runs every time the container startspostAttachCommand- Runs when you attach to the container
What Gets Included in the Snapshot
The prebuild snapshot captures the entire Dev Container filesystem, including:- Installed dependencies and packages
- Built artifacts and compiled code
- Downloaded assets and data
- File system changes made during prebuild execution
- All files in the container (not limited to specific directories)
Benefits
- Faster environment startup: Skip dependency installation and build steps
- Consistent environments: All team members start from the same pre-configured state
- Reduced resource usage: Build once, use many times
- Better developer experience: Get coding immediately without waiting for setup
How Prebuilds Work
- Trigger: A prebuild is triggered based on your configuration (daily schedule or manual trigger)
- Environment creation: Ona creates a temporary environment using your project’s configuration
- Command execution: Dev Container lifecycle commands and prebuild automation tasks run
- Snapshot creation: Once commands complete, Ona creates a snapshot of the environment
- Cleanup: The temporary environment is deleted after successful completion
- Usage: When you create a new environment, it starts from the most recent successful prebuild snapshot
Prebuild Lifecycle
Prebuilds go through several phases:- Pending: Prebuild created, waiting to start
- Starting: Environment is being created
- Running: Commands and tasks are executing
- Stopping: Commands completed, environment is stopping
- Snapshotting: Creating a snapshot of the environment
- Completed: Prebuild successful, snapshot available
- Failed: Prebuild encountered an error
Secrets and Authentication
During prebuild execution:- Organization secrets: Available to all prebuilds
- Project secrets: Available to prebuilds for that project
- User secrets: Not available (prebuilds run without user context)
Prebuild User Context
Prebuilds currently run as a user:- Scheduled prebuilds: Run as the user who created the project
- Manual prebuilds: Run as the user who triggered the prebuild
Timeouts
| Timeout Type | Default | Range | Description |
|---|---|---|---|
| Prebuild execution | 1 hour | 5 minutes - 2 hours | Time allowed for running the environment with Dev Container build/lifecycle commands and automation prebuild tasks (configurable per project) |
| Snapshotting | 1 hour | Fixed | Time allowed for creating the snapshot after prebuild execution completes |
| Overall timeout | 3 hours | Fixed | Catch-all timeout for the entire prebuild process, including environment creation, command execution, and snapshotting |
Prebuild Retention
- Prebuilds are automatically deleted after 7 days
- Only the most recent successful prebuild per environment class is used
- Failed prebuilds are retained for debugging but don’t affect environment creation
Pricing
Ona Cloud
- Environment usage: Standard usage-based billing applies for the time the prebuild environment runs
- Storage: Prebuild snapshots are currently free (this may change in the future)
Enterprise (Your Cloud)
- Environment usage: You pay for the compute resources used to run the prebuild environment
- Storage: You pay only for the actual data stored in the prebuild snapshot. For example, if you use 50GB of a 100GB volume, you’re billed for 50GB. Snapshots are stored as volume snapshots in your cloud provider (backed by S3).
Runner Availability
Prebuilds are currently available on:- AWS Enterprise runners: Fully supported (requires updating your CloudFormation stack to the latest version)
- Ona Cloud: Fully supported
- GCP Enterprise runners: Coming soon
Limitations
- Prebuilds are tied to a specific environment class on a runner
- Only one prebuild per environment class is active at a time
- Currently only daily scheduling is available (more trigger options coming soon)
- Prebuilds cannot currently be triggered on every commit (coming soon)
- Service accounts for running prebuilds are not yet available (coming soon)