Skip to content

Add template to dagger project init #1716

@TomChv

Description

@TomChv

Context

Currently, dagger project init only create an empty cue.mod.
I think it would be great to also generate template file to facilitate initialisation.

V1.0 - Simple initialisation

To begin with, dagger project init could generate a simple main.cue file with a Hello World

// main.cue
package main

import (
	"dagger.io/dagger"
	"universe.dagger.io/bash"
	"universe.dagger.io/alpine"
)


dagger.#Plan & {
	actions: {
               // Pull and build alpine container with bash
		_image: alpine.#Build & {
			packages: {
				bash: _
			}
		}

		// Hello World Dagger
		hello: bash.#Run & {
			input: _image.output
			script: contents: "echo Hello World"
		}
	}
}

Indeed, I think we can add additional advices or whatever useful to onboard on initialisation

V2.0 - Template

As a final improvement, we could create a complete library with many useful template for multiple use-cases.
Here a list of possible template :

  • Build and push a container
  • Deploy a website to vercel
  • Golang CI (test, build, lint...)
  • Node CI (test, build, lint...)
  • Hello world (from v1.0)
  • Kubernetes deployment
  • AWS configuration
  • GCP configuration

Feel free to add any idea in this list.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions