
Dagger Has a Free CI/CD API That Runs Pipelines as Code
Dagger lets you write CI/CD pipelines in TypeScript, Python, or Go — not YAML. Run the same pipeline locally and in CI with container-based caching. TypeScript Pipeline import { dag , Container , Directory } from ' @dagger.io/dagger ' ; async function main () { // Get source code const src = dag . host (). directory ( ' . ' ); // Build const build = dag . container () . from ( ' node:20-slim ' ) . withDirectory ( ' /app ' , src ) . withWorkdir ( ' /app ' ) . withExec ([ ' npm ' , ' install ' ]) . withExec ([ ' npm ' , ' run ' , ' build ' ]); // Test const test = build . withExec ([ ' npm ' , ' test ' ]); await test . stdout (); // Publish container image const image = build . withEntrypoint ([ ' npm ' , ' start ' ]) . publish ( ' ttl.sh/my-app:latest ' ); console . log ( `Published: ${ await image } ` ); } Python Pipeline import dagger async def main (): async with dagger . Connection () as client : src = client . host (). directory ( " . " ) python = ( client . container () . from_ (
Continue reading on Dev.to DevOps
Opens in a new tab




