Cloud Native Build
# CNB
Cloud Native Build is based on the Docker ecosystem, which abstracts the environment, cache, and plugins. It helps developers build software more efficiently by using declarative syntax.
- Declarative: Declarative syntax, programmable and easy to share.
- Easy management: Pipeline as code.
- Cloud Native: Resource pooling, shielding infrastructure complexity.
# Declarative Build Environment
main:
push:
- docker:
image: node:20
stages:
- name: print node version
script:
- node -v
- npm install
- npm test
# Declarative Build Cache
main:
push:
- docker:
image: node:20
volumes:
- /root/.npm:copy-on-write
stages:
- name: print node version
script:
- node -v
- npm install
- npm test
# Using Docker as a Task Runtime Environment
main:
push:
- stages:
- name: run with node 20
image: node:20
script:
- node -v
- name: run with node 21
image: node:21
script:
- node -v
# Docker Ecosystem Plugins
main:
push:
- stages:
- name: hello world
image: cnbcool/hello-world
# On-Demand Computing Resources
main:
push:
- runner:
cpus: 64
docker:
image: node:20
stages:
- name: install and test
script:
- node -v
- npm install
- npm test
# Cloud Native Development
$:
vscode:
- runner:
cpus: 64
services:
- vscode
docker:
image: node:20
volumes:
- node_modules:copy-on-write
stages:
- name: npm install
script: npm install
# High Performance
# CPU Flexibility
By using runner.cpus
, you can declare the required CPU resources as needed, with a maximum of 64 cores
.
# Seconds-Level Cloning
Based on OverlayFS
, git-clone-yyds (opens new window)
can complete code preparation within seconds, easily supporting 100GB+
large repositories.
# Concurrent Caching
copy-on-write
enables copy-on-write caching, eliminating concerns about cache read-write conflicts in concurrent scenarios.
main:
push:
- runner:
cpus: 64
services:
- git-clone-yyds
docker:
image: node:20
volumes:
- /root/.npm:copy-on-write
stages:
- name: print node version
script:
- node -v
- npm install
- npm test