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/daggerverse/dagger-ghcr-demo
Installation
dagger install github.com/daggerverse/dagger-ghcr-demo@v0.1.5
Entrypoint
Return Type
DaggerGhcrDemo
Example
dagger -m github.com/daggerverse/dagger-ghcr-demo@f0cbd8bc8393bf7f8cbee6d5f5bf1751ba1927d8 call \
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
Name | Type | Default Value | Description |
---|---|---|---|
buildContext | Directory ! | - | No description provided |
Example
dagger -m github.com/daggerverse/dagger-ghcr-demo@f0cbd8bc8393bf7f8cbee6d5f5bf1751ba1927d8 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
Name | Type | Default Value | Description |
---|---|---|---|
registry | String ! | - | No description provided |
imageName | String ! | - | No description provided |
username | String ! | - | No description provided |
password | Secret ! | - | No description provided |
buildContext | Directory ! | - | No description provided |
Example
dagger -m github.com/daggerverse/dagger-ghcr-demo@f0cbd8bc8393bf7f8cbee6d5f5bf1751ba1927d8 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)
}