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.
Review-first install path
This asset needs a review step. The copied prompt tells the agent to dry-run, show the writes, then proceed only after confirmation.
npx -y tokrepo@latest install de970503-2a60-4dab-bddf-22cac6cf0357 --target codexDry-run first, confirm the writes, then run this command.
What it is
Dagger is a programmable CI/CD engine that lets you define pipelines in TypeScript, Python, or Go instead of vendor-specific YAML. Every pipeline step runs inside a container, so the behavior is identical whether you execute it on your laptop, in GitHub Actions, or in GitLab CI.
It targets platform engineers and DevOps teams tired of debugging YAML syntax errors, vendor lock-in, and the 'works on my machine' gap between local dev and CI environments.
How it saves time or tokens
Traditional CI systems require pushing code to trigger a pipeline, waiting for results, then iterating. Dagger pipelines run locally in seconds, giving you instant feedback. Because pipelines are real code, you get IDE autocomplete, type checking, unit tests, and code reuse — none of which YAML supports. Debugging shifts from reading CI logs to running a debugger.
How to use
- Install the Dagger CLI with
curl -fsSL https://dl.dagger.io/dagger/install.sh | shorbrew install dagger/tap/dagger. - Initialize a Dagger module in your project with
dagger init --sdk=typescript(or python/go). - Write your pipeline functions, then run them with
dagger call <function-name>.
Example
// dagger/src/index.ts
import { dag, Container, object, func } from '@dagger.io/dagger'
@object()
class MyPipeline {
@func()
async test(): Promise<string> {
return dag
.container()
.from('node:20-slim')
.withDirectory('/app', dag.host().directory('.'))
.withWorkdir('/app')
.withExec(['npm', 'install'])
.withExec(['npm', 'test'])
.stdout()
}
}
Related on TokRepo
- DevOps tools — CI/CD, infrastructure, and deployment automation
- Automation tools — Workflow and task automation for developers
Common pitfalls
- Dagger requires Docker (or a compatible container runtime) running locally. If Docker Desktop is not running,
dagger callfails immediately. - Pipeline functions must be deterministic for caching to work. Non-deterministic steps (like fetching 'latest' tags) bust the cache on every run.
- The SDK learning curve exists even though you write 'real code.' Understanding Dagger's container chaining model takes a few iterations.
Frequently Asked Questions
Not exactly. Dagger replaces the YAML pipeline definitions, but you still need a CI runner to trigger builds on push or PR. You call Dagger from a minimal GitHub Actions workflow (or GitLab CI job). The key benefit is that the same pipeline runs locally and in CI without modification.
Dagger officially supports TypeScript, Python, and Go SDKs. Each SDK provides the same core functionality. Choose the language your team is most comfortable with. The underlying execution is identical regardless of SDK.
Dagger automatically caches container layers and step outputs. If a step's inputs have not changed, Dagger skips re-execution and reuses the cached result. This makes subsequent pipeline runs significantly faster, similar to Docker layer caching but applied to your pipeline logic.
Yes. Dagger pipelines can include deployment steps (pushing Docker images, running Helm upgrades, calling cloud APIs). Since everything runs in containers, your deployment logic is reproducible and auditable.
Earthly uses a Dockerfile-like syntax (Earthfile) while Dagger uses real programming languages. Bazel is a build system focused on hermetic builds for monorepos. Dagger is specifically designed for CI/CD pipelines and emphasizes local-remote parity and SDK-based authoring.
Citations (3)
- Dagger GitHub Repository— Dagger lets you write CI/CD pipelines in TypeScript, Python, or Go
- Dagger Official Docs— Dagger SDK documentation and getting started
- Docker Build Documentation— Containerized CI/CD execution model
Related on TokRepo
Source & Thanks
Discussion
Related Assets
Concourse — Container-Native CI/CD with Pipelines as Code
Build reliable CI/CD pipelines with Concourse. Every step runs in an isolated container, pipelines are declarative YAML, and the resource model makes dependencies explicit and reproducible.
Dagger — Programmable CI/CD Engine
Run CI/CD pipelines as code — locally, in CI, or in the cloud. Replace YAML with real programming languages. Cacheable, portable, testable. 15.6K+ stars.
Tekton Pipelines — Cloud-Native CI/CD Primitives for Kubernetes
Tekton Pipelines is a powerful, flexible, open-source framework for creating CI/CD systems. It runs pipelines as native Kubernetes resources using Tasks, Pipelines and TaskRuns.
GitLab CE — Open Source DevOps Platform with Built-In CI/CD
GitLab Community Edition is a complete DevOps platform delivered as a single application, covering source code management, CI/CD pipelines, issue tracking, container registry, and more.