---
url: /en/build/intro.md
description: >
  Overview of Cloud Native Build, a Docker-based CI/CD system with declarative
  syntax for defining build environments, caches, and plugins alongside source
  code.
---
Cloud Native Build is based on the Docker ecosystem, abstracting environments,
caches, and plugins through declarative syntax that lets
you build software efficiently.

* Declarative: Programmable, easy-to-share configuration syntax
* Easy to manage: Source-controlled alongside code, version-tracked
* Cloud Native: Resource pooling that reduces infrastructure operational costs

### Build Environment & Cache

In the declarative configuration, specify the build environment via
`docker.image` and declare cache directories via `volumes`:

```yaml{4,7,8} title=".cnb.yml"
main:
  push:
    - docker:
        image: node:20
        volumes:
          - /root/.npm:copy-on-write
      stages:
        - node -v
        - npm install
        - npm test
```

### Docker as Task Execution Environment

Each stage can use a different image, suitable for scenarios requiring multiple languages or versions:

```yaml{5,8} title=".cnb.yml"
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 Based Plugins

Extend build capabilities with community or official plugins:

```yaml{5} title=".cnb.yml"
main:
  push:
    - stages:
        - name: hello world
          image: cnbcool/hello-world
```

### On-demand Computing Resources

Request higher-spec compute resources via `runner.cpus`, up to **64 cores**:

```yaml{4} title=".cnb.yml"
main:
  push:
    - runner:
        cpus: 64
      docker:
        image: node:20
        volumes:
          - /root/.npm:copy-on-write
      stages:
        - node -v
        - npm install
        - npm test
```

### Workspaces

Remote development environments are also declared using `.cnb.yml`:

```yaml{5,6} title=".cnb.yml"
$:
  vscode:
    - runner:
        cpus: 64
      services:
        - vscode
      docker:
        image: node:20
        volumes:
          - node_modules:copy-on-write
      stages:
        - npm install
```

## High Performance

### Elastic CPU Scaling

* [runner.cpus](./grammar.md#pipeline-cpus)

Through `runner.cpus`, you can request CPU resources on demand, up to **64 cores**.

### Second-level Cloning

Based on `OverlayFS`, [git-clone-yyds](https://cnb.cool/cnb/cool/git-clone-yyds)
can complete code preparation in seconds, easily supporting **100GB+** large repositories.

### Cross-Node Caching

* [docker:cache](../build/internal-steps/docker/cache.md)

When you need to share caches across nodes, use the `docker:cache` built-in task to build the cache as a Docker image:

```yaml title=".cnb.yml"
main:
  push:
    - stages:
        - name: build cache
          type: docker:cache
          options:
            dockerfile: cache.dockerfile
            by:
              - package.json
              - package-lock.json
            versionBy:
              - package-lock.json
          exports:
            name: DOCKER_CACHE_IMAGE_NAME
        - name: use cache
          image: $DOCKER_CACHE_IMAGE_NAME
          commands:
            - cp -r "$NODE_PATH" ./node_modules
```

### Concurrent Caching

* [copy-on-write](./grammar.md#pipeline-volumes)

`copy-on-write` enables copy-on-write for caches, eliminating cache read-write conflicts in concurrent scenarios.
