Dagger
Search

dagger-ghcr-demo

A demo of how to push to a container registry, in this case github ghcr.io, from a github action.

Not intended to be used directly as a dagger module because it's so simple, more of an example to copy from.

For GitHub Actions yaml and dagger go code to copy, see the README at https://github.com/lukemarsden/dagger-ghcr-demo

Installation

dagger install github.com/lukemarsden/dagger-ghcr-demo@v0.1.4

Entrypoint

Return Type
DaggerGhcrDemo
Example
func (m *myModule) example() *DaggerGhcrDemo  {
	return dag.
			DaggerGhcrDemo()
}
@function
def example() -> dag.DaggerGhcrDemo:
	return (
		dag.dagger_ghcr_demo()
	)
@func()
example(): DaggerGhcrDemo {
	return dag
		.daggerGhcrDemo()
}

Types

DaggerGhcrDemo

build()

Application specific build logic

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
buildContextDirectory !-No description provided
Example
dagger -m github.com/lukemarsden/dagger-ghcr-demo@835a4e3b81e9ffc3899de996c0e7fb5d2bdfc712 call \
 build --build-context DIR_PATH
func (m *myModule) example(buildContext *Directory) *Container  {
	return dag.
			DaggerGhcrDemo().
			Build(buildContext)
}
@function
def example(build_context: dagger.Directory) -> dagger.Container:
	return (
		dag.dagger_ghcr_demo()
		.build(build_context)
	)
@func()
example(buildContext: Directory): Container {
	return dag
		.daggerGhcrDemo()
		.build(buildContext)
}

buildAndPush()

Take the built container and push it

Return Type
Void !
Arguments
NameTypeDefault ValueDescription
registryString !-No description provided
imageNameString !-No description provided
usernameString !-No description provided
passwordSecret !-No description provided
buildContextDirectory !-No description provided
Example
dagger -m github.com/lukemarsden/dagger-ghcr-demo@835a4e3b81e9ffc3899de996c0e7fb5d2bdfc712 call \
 build-and-push --registry string --image-name string --username string --password env:MYSECRET --build-context DIR_PATH
func (m *myModule) example(ctx context.Context, registry string, imageName string, username string, password *Secret, buildContext *Directory)   {
	return dag.
			DaggerGhcrDemo().
			BuildAndPush(ctx, registry, imageName, username, password, buildContext)
}
@function
async def example(registry: str, image_name: str, username: str, password: dagger.Secret, build_context: dagger.Directory) -> None:
	return await (
		dag.dagger_ghcr_demo()
		.build_and_push(registry, image_name, username, password, build_context)
	)
@func()
async example(registry: string, imageName: string, username: string, password: Secret, buildContext: Directory): Promise<void> {
	return dag
		.daggerGhcrDemo()
		.buildAndPush(registry, imageName, username, password, buildContext)
}