# Dagger — CI/CD Pipelines as Code in Any Language > Run CI/CD pipelines locally and in the cloud with the same code. Write pipelines in TypeScript, Python, or Go instead of YAML. Containerized execution ensures identical results everywhere. 12,000+ stars. ## Install Save as a script file and run: ## Quick Use ```bash # Install curl -fsSL https://dl.dagger.io/dagger/install.sh | sh # Initialize in your project dagger init --sdk=typescript ``` ```typescript // dagger/src/index.ts import { dag, Container, Directory, object, func } from "@dagger.io/dagger"; @object() class MyPipeline { @func() async build(source: Directory): Promise { return await dag .container() .from("node:22") .withDirectory("/app", source) .withWorkdir("/app") .withExec(["npm", "install"]) .withExec(["npm", "run", "build"]) .stdout(); } @func() async test(source: Directory): Promise { return await dag .container() .from("node:22") .withDirectory("/app", source) .withExec(["npm", "test"]) .stdout(); } } ``` ```bash dagger call build --source=. dagger call test --source=. ``` --- ## Intro Dagger is a CI/CD engine that lets you write pipelines as code in TypeScript, Python, or Go instead of YAML with 12,000+ GitHub stars. Every step runs in a container, so pipelines produce identical results on your laptop and in CI. Debug locally before pushing — no more "works on my machine but fails in CI" problems. Best for teams tired of YAML-based CI and wanting testable, type-safe pipelines. Works with: GitHub Actions, GitLab CI, CircleCI, Jenkins, or standalone. Setup time: under 5 minutes. --- ## Why Code Over YAML | YAML CI | Dagger | |---------|--------| | Trial-and-error debugging | Debug locally first | | No type checking | Full IDE support | | Copy-paste reuse | Functions and modules | | Vendor lock-in | Run anywhere | | Different local vs CI | Identical everywhere | ### Local = CI ```bash # Same pipeline, same results dagger call test --source=. # On your laptop dagger call test --source=. # In GitHub Actions # Containerized execution ensures identical behavior ``` ### Multi-Language SDKs **TypeScript:** ```typescript @func() async deploy(image: string): Promise { return await dag.container().from(image).withExec(["deploy.sh"]).stdout(); } ``` **Python:** ```python @function async def deploy(self, image: str) -> str: return await dag.container().from_(image).with_exec(["deploy.sh"]).stdout() ``` **Go:** ```go func (m *MyPipeline) Deploy(ctx context.Context, image string) (string, error) { return dag.Container().From(image).WithExec([]string{"deploy.sh"}).Stdout(ctx) } ``` ### Caching Built-in layer caching — unchanged steps skip instantly: ```typescript @func() async build(source: Directory): Promise { return dag.container() .from("node:22") .withDirectory("/app", source) .withExec(["npm", "ci"]) // Cached if package-lock unchanged .withExec(["npm", "run", "build"]); } ``` ### CI Integration ```yaml # .github/workflows/ci.yml jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: dagger/dagger-for-github@v6 with: verb: call args: build --source=. ``` ### Key Stats - 12,000+ GitHub stars - TypeScript, Python, Go SDKs - Containerized execution - Local = CI (identical results) - Built-in caching ### FAQ **Q: What is Dagger?** A: A CI/CD engine where you write pipelines as code (TypeScript/Python/Go) instead of YAML, with containerized execution ensuring identical results locally and in CI. **Q: Is Dagger free?** A: Yes, open-source under Apache 2.0. Dagger Cloud (caching service) has a free tier. **Q: Can I use Dagger with GitHub Actions?** A: Yes, Dagger runs inside any CI system. It replaces the pipeline logic, not the CI runner. --- ## Source & Thanks > Created by [Dagger](https://github.com/dagger). Licensed under Apache 2.0. > > [dagger](https://github.com/dagger/dagger) — stars 12,000+ Thanks for making CI/CD pipelines real code instead of YAML. --- ## 快速使用 ```bash curl -fsSL https://dl.dagger.io/dagger/install.sh | sh dagger init --sdk=typescript dagger call build --source=. ``` --- ## 简介 Dagger 是一个用代码(TypeScript/Python/Go)而非 YAML 编写 CI/CD 管道的引擎,GitHub 12,000+ stars。容器化执行确保本地和 CI 结果完全一致。适合厌倦 YAML CI 且想要可测试、类型安全管道的团队。 --- ## 来源与感谢 > Created by [Dagger](https://github.com/dagger). Licensed under Apache 2.0. > > [dagger](https://github.com/dagger/dagger) — stars 12,000+ --- Source: https://tokrepo.com/en/workflows/de970503-2a60-4dab-bddf-22cac6cf0357 Author: Agent Toolkit