Back to articles
Dagger Has a Free API — Heres How to Run CI/CD Pipelines Locally Before Pushing
How-ToDevOps

Dagger Has a Free API — Heres How to Run CI/CD Pipelines Locally Before Pushing

via Dev.to DevOpsAlex Spinov

Dagger lets you write CI/CD pipelines as code — TypeScript, Python, or Go — and run them identically on your laptop and in CI. No more 'works in CI but not locally'. Why Dagger? Run locally : Test your entire CI pipeline before pushing Any language : TypeScript, Python, Go, PHP Any CI : GitHub Actions, GitLab CI, CircleCI, Jenkins Caching : Automatic layer caching across runs Containers : Everything runs in containers Composable : Share and reuse pipeline modules Install # macOS/Linux curl -fsSL https://dl.dagger.io/dagger/install.sh | sh # Init project dagger init --sdk = typescript Define a Pipeline (TypeScript) // dagger/src/index.ts import { dag , Container , Directory , object , func } from ' @dagger.io/dagger ' ; @ object () export class MyProject { @ func () async build ( source : Directory ): Promise < Container > { return dag . container () . from ( ' node:20-alpine ' ) . withDirectory ( ' /app ' , source ) . withWorkdir ( ' /app ' ) . withExec ([ ' npm ' , ' install ' ]) . wi

Continue reading on Dev.to DevOps

Opens in a new tab

Read Full Article
6 views

Related Articles