Understanding Zerops Build Cache
Zerops implements a sophisticated two-layer caching strategy that optimizes build times while maintaining complete control over the build environment. This documentation explores the architecture, configuration patterns, and practical implementation of the build cache system.
Architecture Overview
The build cache operates through two distinct layers:
- Base Layer: Comprises the OS, installed dependencies, and prepare commands
- Build Layer: Contains the state after executing build commands
The layers work together to create an efficient and predictable build environment, though they are currently coupled in their cache invalidation behavior (invalidating one layer affects the other).
Cache Implementation
The caching mechanism is implemented through an efficient file movement strategy. This approach ensures near-instantaneous cache operations through simple directory relocation within the container, implementing the following characteristics:
- Files are moved between
/build/sourceand/build/cacheusing container-level rename operations - No packaging, compression, or network transfer is involved
- Cache preservation is achieved through simple directory relocation within the container
- Files maintain their original state and permissions throughout the process
See detailed build process lifecycle.