apko
Build and Publish OCI Container Images from apk packages
Installation
dagger install github.com/purpleclay/daggerverse/apko@v0.3.0
Entrypoint
Return Type
Apko
Example
dagger -m github.com/purpleclay/daggerverse/apko@074190881a4f503d0e0975f064a8fe58426f426f call \
func (m *myModule) example() *Apko {
return dag.
Apko()
}
@function
def example() -> dag.Apko:
return (
dag.apko()
)
@func()
example(): Apko {
return dag
.apko()
}
Types
Apko 🔗
Apko Dagger Module
load() 🔗
Loads a pre-configured apko configuration file
Return Type
Config !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
cfg | File ! | - | the path to the apko configuration file |
Example
dagger -m github.com/purpleclay/daggerverse/apko@074190881a4f503d0e0975f064a8fe58426f426f call \
load --cfg file:path
func (m *myModule) example(cfg *File) *ApkoConfig {
return dag.
Apko().
Load(cfg)
}
@function
def example(cfg: dagger.File) -> dag.ApkoConfig:
return (
dag.apko()
.load(cfg)
)
@func()
example(cfg: File): ApkoConfig {
return dag
.apko()
.load(cfg)
}
withWolfi() 🔗
Generates and loads a pre-configured apko configuration file for building an image based on the Wolfi OS. By default, the [wolfi-base, ca-certificates-bundle] packages will be installed.
Examples:
Generate a default Wolfi OS apko configuration file
$ dagger call with-wolfi –entrypoint=“/bin/sh -l”
Extend the default Wolfi OS apko configuration file
\( dagger call with-wolfi --entrypoint="echo \\)VAR1” –env=“VAR1:VALUE1”
Return Type
Config !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
archs | [String ! ] | - | a list of container architectures (defaults to amd64) |
cmd | String | - | the command to execute after the container entrypoint |
entrypoint | String ! | - | the entrypoint to the container |
env | [String ! ] | - | a list of environment variables to set within the container image, expected in (key:value) format |
pkgs | [String ! ] | - | a list of packages to install within the container |
Example
dagger -m github.com/purpleclay/daggerverse/apko@074190881a4f503d0e0975f064a8fe58426f426f call \
with-wolfi --entrypoint string
func (m *myModule) example(entrypoint string) *ApkoConfig {
return dag.
Apko().
WithWolfi(entrypoint)
}
@function
def example(entrypoint: str) -> dag.ApkoConfig:
return (
dag.apko()
.with_wolfi(entrypoint)
)
@func()
example(entrypoint: string): ApkoConfig {
return dag
.apko()
.withWolfi(entrypoint)
}
withAlpine() 🔗
Generates and loads a pre-configured apko configuration file for building an image based on the Alpine OS. By default, the [alpine-base, ca-certificates-bundle] packages will be installed.
Examples:
Generate a default alpine OS apko configuration file
$ dagger call with-alpine –entrypoint=“/bin/sh -l”
Extend the default alpine OS apko configuration file
\( dagger call with-alpine --entrypoint="echo \\)VAR1” –env=“VAR1:VALUE1”
Return Type
Config !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
archs | [String ! ] | - | a list of container architectures (defaults to amd64) |
cmd | String | - | the command to execute after the container entrypoint |
entrypoint | String ! | - | the entrypoint to the container |
env | [String ! ] | - | a list of environment variables to set within the container image, expected in (key:value) format |
pkgs | [String ! ] | - | a list of packages to install within the container |
Example
dagger -m github.com/purpleclay/daggerverse/apko@074190881a4f503d0e0975f064a8fe58426f426f call \
with-alpine --entrypoint string
func (m *myModule) example(entrypoint string) *ApkoConfig {
return dag.
Apko().
WithAlpine(entrypoint)
}
@function
def example(entrypoint: str) -> dag.ApkoConfig:
return (
dag.apko()
.with_alpine(entrypoint)
)
@func()
example(entrypoint: string): ApkoConfig {
return dag
.apko()
.withAlpine(entrypoint)
}
Config 🔗
Represents an Apko configuration that forms the basis of all apko commands
yaml() 🔗
Prints the generated apko configuration file to stdout
Return Type
String !
Example
dagger -m github.com/purpleclay/daggerverse/apko@074190881a4f503d0e0975f064a8fe58426f426f call \
with-alpine --entrypoint string \
yaml
func (m *myModule) example(ctx context.Context, entrypoint string) string {
return dag.
Apko().
WithAlpine(entrypoint).
Yaml(ctx)
}
@function
async def example(entrypoint: str) -> str:
return await (
dag.apko()
.with_alpine(entrypoint)
.yaml()
)
@func()
async example(entrypoint: string): Promise<string> {
return dag
.apko()
.withAlpine(entrypoint)
.yaml()
}
build() 🔗
Builds an image from an apko configuration file and outputs it as a file that can be imported using:
$ docker load < image.tar
Examples:
Build an OCI image from a provided apko configuration file
$ dagger call load –cfg apko.yaml build –ref registry:5000/example:latest
Build an OCI image based on the Wolfi OS
$ dagger call with-wolfi build –ref registry:5000/example:latest
Return Type
Directory !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
annotations | [String ! ] | - | additional OCI annotations to add to the built image, expected in (key:value) format |
archs | [String ! ] | - | a list of architectures to build, overwriting the config |
pkgs | [String ! ] | - | a list of additional packages to include within the built image |
repos | [String ! ] | - | a list of additional repositories used to pull packages into the built image |
ref | String ! | - | the image reference to build |
vcs | Boolean | - | detect and embed VCS URLs within the built OCI image default=true |
sbom | Boolean | true | generate and embed an SBOM (software bill of materials) within the built OCI image |
Example
dagger -m github.com/purpleclay/daggerverse/apko@074190881a4f503d0e0975f064a8fe58426f426f call \
with-alpine --entrypoint string \
build --ref string
func (m *myModule) example(entrypoint string, ref string) *Directory {
return dag.
Apko().
WithAlpine(entrypoint).
Build(ref)
}
@function
def example(entrypoint: str, ref: str) -> dagger.Directory:
return (
dag.apko()
.with_alpine(entrypoint)
.build(ref)
)
@func()
example(entrypoint: string, ref: string): Directory {
return dag
.apko()
.withAlpine(entrypoint)
.build(ref)
}
publish() 🔗
Builds an image from an apko configuration file and publishes it to an OCI image registry
Examples:
Publish an OCI image from a provided apko configuration file
$ dagger call load –cfg apko.yaml publish –ref registry:5000/example:latest
Publish an OCI image based on the Wolfi OS
$ dagger call with-wolfi build –ref registry:5000/example:latest
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
annotations | [String ! ] | - | additional OCI annotations to add to the built image, expected in (key:value) format |
archs | [String ! ] | - | a list of architectures to build, overwriting the config |
pkgs | [String ! ] | - | a list of additional packages to include within the built image |
repos | [String ! ] | - | a list of additional repositories used to pull packages into the built image |
ref | String ! | - | the image reference to build |
vcs | Boolean | - | detect and embed VCS URLs within the built OCI image default=true |
sbom | Boolean | true | generate and embed an SBOM (software bill of materials) within the built OCI image |
registry | String | "docker.io" | the address of the registry to authenticate with |
username | String | - | the username for authenticating with the registry |
password | Secret | - | the password for authenticating with the registry |
Example
dagger -m github.com/purpleclay/daggerverse/apko@074190881a4f503d0e0975f064a8fe58426f426f call \
with-alpine --entrypoint string \
publish --ref string
func (m *myModule) example(ctx context.Context, entrypoint string, ref string) string {
return dag.
Apko().
WithAlpine(entrypoint).
Publish(ctxref)
}
@function
async def example(entrypoint: str, ref: str) -> str:
return await (
dag.apko()
.with_alpine(entrypoint)
.publish(ref)
)
@func()
async example(entrypoint: string, ref: string): Promise<string> {
return dag
.apko()
.withAlpine(entrypoint)
.publish(ref)
}