Dagger Node.js SDK in CI
- GitHub Actions
- CircleCI
- GitLab
- Jenkins
.github/workflows/dagger.yaml
name: dagger
on:
push:
branches: [main]
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: actions/checkout@v3
- name: Install deps
run: npm ci
- name: Run Dagger pipeline
run: node index.mjs
Ensure that your package.json
contains @dagger.io/dagger
which can be installed using the documentation.
.circleci/config.yml
version: 2.1
jobs:
build:
docker:
- image: cimg/node:lts
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Install deps
command: npm ci
- run:
name: Dagger Pipeline
command: node index.mjs
workflows:
dagger:
jobs:
- build
Ensure that your package.json
contains @dagger.io/dagger
which can be installed using the documentation.
.gitlab-ci.yml
.docker:
image: node:18-alpine
services:
- docker:${DOCKER_VERSION}-dind
variables:
DOCKER_HOST: tcp://docker:2376
DOCKER_TLS_VERIFY: '1'
DOCKER_TLS_CERTDIR: '/certs'
DOCKER_CERT_PATH: '/certs/client'
DOCKER_DRIVER: overlay2
DOCKER_VERSION: '20.10.16'
.dagger:
extends: [.docker]
before_script:
- apk add docker-cli
build:
extends: [.dagger]
script:
- npm ci
- node index.mjs
Ensure that your package.json
contains @dagger.io/dagger
which can be installed using the documentation.
Jenkinsfile
pipeline {
agent { label 'dagger' }
stages {
stage("dagger") {
steps {
sh '''
npm ci
node index.mjs
'''
}
}
}
}
Requires docker
client and Node.js installed on your Jenkins agent, a Docker host available (can be docker:dind
), and agents labeled in Jenkins with dagger
. Ensure that your package.json
contains @dagger.io/dagger
which can be installed using the documentation.