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.
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
Moodle — Open-Source Learning Management System
The most widely used open-source learning platform, providing course management, assessments, and collaboration tools for educators and organizations worldwide.
Sylius — Headless E-Commerce Framework on Symfony
An open-source headless e-commerce platform built on Symfony and API Platform, designed for developers who need a customizable and API-first commerce solution.
Akaunting — Free Self-Hosted Accounting Software
A free, open-source online accounting application built on Laravel for small businesses and freelancers to manage invoices, expenses, and financial reports.