Skip to content

A lightweight demo CI pipeline using Dagger, Node.js, and Docker — created for the MWdSE course to showcase automated testing, building, and artifact generation.

Notifications You must be signed in to change notification settings

moearzini/mwdse-dagger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MWdSE Dagger Demo

This repository contains a demo project for the course
“Methoden und Werkzeuge der Softwareentwicklung (MWdSE)”.

The goal is to show how Dagger can be used as a lightweight, cross-platform CI pipeline to:

  • install dependencies inside a container
  • run automated tests
  • build a small TypeScript/Node.js application
  • export build artifacts to the user’s Desktop

The code is intentionally simple so that CI/CD concepts stay in focus.


What This Repository Demonstrates

  • A minimal TypeScript/Node.js project (src/)
  • A small unit test suite using Vitest (tests/)
  • A Dagger pipeline defined in ci.mts that:
    • uses a node:22-alpine container
    • runs npm install and npm test
    • runs npm run build
    • exports build artifacts to a folder on the user’s Desktop

This repo is meant as a teaching example, not a production-ready application.


Requirements

To run the pipeline locally, you need:

  • Git
  • Node.js (version 18 or later)
  • TypeScript (tsc)
  • Docker Desktop (installed and running)
  • Dagger CLI

Installation Instructions

macOS

  1. Install Homebrew (if not already installed):
    See: https://brew.sh

  2. Install Node.js and Git:

     brew install node git
    
  3. Install TypeScript globally:

     npm install -g typescript
    
  4. Install Docker Desktop:

     brew install --cask docker
    
  5. Install Dagger CLI:

     brew install dagger/tap/dagger
    

Windows

  1. Install Node.js via winget (or from nodejs.org):

     winget install OpenJS.NodeJS
    
  2. Install TypeScript globally:

     npm install -g typescript
    
  3. Install Docker Desktop:
    Download from: https://www.docker.com/products/docker-desktop
    After installation, start Docker so that the Docker daemon is running.

  4. Install Dagger CLI via winget:

     winget install Dagger.Cli
    

Using the CI Pipeline

The CI pipeline is defined in ci.mts and executed via the Dagger CLI.

1. Clone the repository

    git clone https://github.com/moearzini/mwdse-dagger
    cd mwdse-dagger

2. Install Node dependencies (once)

    npm install

3. Run tests locally (optional check)

    npm test

4. Run the Dagger CI pipeline

Recommended commands:

    dagger run --progress plain node --loader ts-node/esm ./ci.mts

Explanation:

  • dagger run
    Starts a Dagger session and runs the pipeline.

  • --progress plain
    Shows a simple, readable log output (good for demos and screenshots).

  • node --loader ts-node/esm
    Tells Node to execute the TypeScript module ci.mts directly using ts-node in ESM mode.

  • ./ci.mts
    The pipeline definition file. It:

    1. mounts the project into a node:22-alpine container
    2. runs npm install
    3. runs npm test
    4. runs npm run build
    5. exports the compiled build and a container image as artifacts to a folder on the user’s Desktop (e.g. mwdse-dagger-artifacts)

After a successful run, you will find the exported build artifacts in a directory created on your Desktop.

In order to run an artefact, use...

    docker load < app-image.tar
    docker images
    docker run -it <image_name> /bin/sh

📁 Repository Structure

    src/                # Application logic (TypeScript)
    tests/              # Unit tests (Vitest)
    ci.mts              # Dagger CI pipeline definition
    package.json        # Node.js project configuration
    tsconfig.json       # TypeScript configuration
    README.md           # This documentation

License

This project is intended for educational use only as part of the MWdSE course @DHBW Mannheim.

About

A lightweight demo CI pipeline using Dagger, Node.js, and Docker — created for the MWdSE course to showcase automated testing, building, and artifact generation.

Topics

Resources

Stars

Watchers

Forks