An example of using Dagger.io to test, build and publish an application
- Docker or any other OCI runtime installed
This approach uses the DevContainer extension to spin up a development environment with Go and Dagger.io CLI pre-installed.
- Clone the repository
git clone https://github.com/techchapter/dagger-pipeline-example.git- Open the repository in Visual Studio Code
code dagger-pipeline-example-
Run command "Reopen in Container" inside Visual Studio Code
-
Run the Dagger.io CLI to test and build the pipeline locally
dagger run --silent go run ./ci/ci.go- The output should look something like this
DEV environment: exported file to ./ping-socket.tar
To run use docker load -i ./ping-socket.tarThis approach expect you to install Go and Dagger.io CLI on your development machine.
- Install Go and Dagger.io CLI
- Clone the repository
git clone https://github.com/techchapter/dagger-pipeline-example.git- Run the Dagger.io CLI to test and build the pipeline locally
dagger run --silent go run ./ci/ci.go- The output should look something like this
DEV environment: exported file to ./ping-socket.tar
To run use docker load -i ./ping-socket.tar- Fork the GitHub repository
- Clone the forked repository
- Create a simple change like the following
echo "RUN" >> changed-file.txt- Commit and Push the change to the forked repo
- See the GitHub action running the CI pipeline, but this time actually publish the image to ttl.sh
- The output should look something like this
Published image to: ttl.sh/ping-socket-2021992@sha256:876f28eb26c9469df381f03ad9c82d4648a56349c984d37b186379228ba452b1