Dagger
Search

container-image

It includes methods to set various properties of the container image and generate appropriate Docker image tags.

Installation

dagger install github.com/dictybase-docker/dagger-of-dcr/container-image@320e2dab141bc6c728f623e9ac4797aaf28b769e

Entrypoint

Return Type
ContainerImage
Example
func (m *myModule) example() *ContainerImage  {
	return dag.
			ContainerImage()
}
@function
def example() -> dag.ContainerImage:
	return (
		dag.container_image()
	)
@func()
example(): ContainerImage {
	return dag
		.containerImage()
}

Types

ContainerImage 🔗

repository() 🔗

Repository name

Return Type
String !
Example
func (m *myModule) example(ctx context.Context) string  {
	return dag.
			ContainerImage().
			Repository(ctx)
}
@function
async def example() -> str:
	return await (
		dag.container_image()
		.repository()
	)
@func()
async example(): Promise<string> {
	return dag
		.containerImage()
		.repository()
}

ref() 🔗

Git reference

Return Type
String !
Example
func (m *myModule) example(ctx context.Context) string  {
	return dag.
			ContainerImage().
			Ref(ctx)
}
@function
async def example() -> str:
	return await (
		dag.container_image()
		.ref()
	)
@func()
async example(): Promise<string> {
	return dag
		.containerImage()
		.ref()
}

namespace() 🔗

The docker namespace under which the image will be pushed

Return Type
String !
Example
func (m *myModule) example(ctx context.Context) string  {
	return dag.
			ContainerImage().
			Namespace(ctx)
}
@function
async def example() -> str:
	return await (
		dag.container_image()
		.namespace()
	)
@func()
async example(): Promise<string> {
	return dag
		.containerImage()
		.namespace()
}

dockerfile() 🔗

Specifies the path to the Dockerfile

Return Type
String !
Example
func (m *myModule) example(ctx context.Context) string  {
	return dag.
			ContainerImage().
			Dockerfile(ctx)
}
@function
async def example() -> str:
	return await (
		dag.container_image()
		.dockerfile()
	)
@func()
async example(): Promise<string> {
	return dag
		.containerImage()
		.dockerfile()
}

image() 🔗

Name of the image to be built

Return Type
String !
Example
func (m *myModule) example(ctx context.Context) string  {
	return dag.
			ContainerImage().
			Image(ctx)
}
@function
async def example() -> str:
	return await (
		dag.container_image()
		.image()
	)
@func()
async example(): Promise<string> {
	return dag
		.containerImage()
		.image()
}

dockerImageTag() 🔗

Return Type
String !
Example
func (m *myModule) example(ctx context.Context) string  {
	return dag.
			ContainerImage().
			DockerImageTag(ctx)
}
@function
async def example() -> str:
	return await (
		dag.container_image()
		.docker_image_tag()
	)
@func()
async example(): Promise<string> {
	return dag
		.containerImage()
		.dockerImageTag()
}

withNamespace() 🔗

WithNamespace sets the docker namespace

Return Type
ContainerImage !
Arguments
NameTypeDefault ValueDescription
namespaceString !"dictybase"The docker namespace under which the image will be pushed
Example
func (m *myModule) example(namespace string) *ContainerImage  {
	return dag.
			ContainerImage().
			WithNamespace(namespace)
}
@function
def example(namespace: str) -> dag.ContainerImage:
	return (
		dag.container_image()
		.with_namespace(namespace)
	)
@func()
example(namespace: string): ContainerImage {
	return dag
		.containerImage()
		.withNamespace(namespace)
}

withRef() 🔗

WithRef sets the Git reference (branch, tag, or SHA)

Return Type
ContainerImage !
Arguments
NameTypeDefault ValueDescription
refString !-the branch, tag or sha to checkout
Example
func (m *myModule) example(ref string) *ContainerImage  {
	return dag.
			ContainerImage().
			WithRef(ref)
}
@function
def example(ref: str) -> dag.ContainerImage:
	return (
		dag.container_image()
		.with_ref(ref)
	)
@func()
example(ref: string): ContainerImage {
	return dag
		.containerImage()
		.withRef(ref)
}

withRepository() 🔗

WithRepository sets the GitHub repository name

Return Type
ContainerImage !
Arguments
NameTypeDefault ValueDescription
repositoryString !-github repository name with owner, for example tora/bora, Required
Example
func (m *myModule) example(repository string) *ContainerImage  {
	return dag.
			ContainerImage().
			WithRepository(repository)
}
@function
def example(repository: str) -> dag.ContainerImage:
	return (
		dag.container_image()
		.with_repository(repository)
	)
@func()
example(repository: string): ContainerImage {
	return dag
		.containerImage()
		.withRepository(repository)
}

withDockerfile() 🔗

WithDockerfile sets the Dockerfile path

Return Type
ContainerImage !
Arguments
NameTypeDefault ValueDescription
dockerFileString "build/package/Dockerfile"specifies the path to the Dockerfile
Example
func (m *myModule) example() *ContainerImage  {
	return dag.
			ContainerImage().
			WithDockerfile()
}
@function
def example() -> dag.ContainerImage:
	return (
		dag.container_image()
		.with_dockerfile()
	)
@func()
example(): ContainerImage {
	return dag
		.containerImage()
		.withDockerfile()
}

withImage() 🔗

WithImage sets the image name

Return Type
ContainerImage !
Arguments
NameTypeDefault ValueDescription
imageString !-name of the image to be built
Example
func (m *myModule) example(image string) *ContainerImage  {
	return dag.
			ContainerImage().
			WithImage(image)
}
@function
def example(image: str) -> dag.ContainerImage:
	return (
		dag.container_image()
		.with_image(image)
	)
@func()
example(image: string): ContainerImage {
	return dag
		.containerImage()
		.withImage(image)
}

publishFromRepo() 🔗

PublishFromRepo publishes a container image to Docker Hub

Return Type
String !
Arguments
NameTypeDefault ValueDescription
userString !-dockerhub user name
passwordString !-dockerhub password, use an api token
Example
func (m *myModule) example(ctx context.Context, user string, password string) string  {
	return dag.
			ContainerImage().
			PublishFromRepo(ctx, user, password)
}
@function
async def example(user: str, password: str) -> str:
	return await (
		dag.container_image()
		.publish_from_repo(user, password)
	)
@func()
async example(user: string, password: string): Promise<string> {
	return dag
		.containerImage()
		.publishFromRepo(user, password)
}

fakePublishFromRepo() 🔗

FakePublishFromRepo publishes a container image to a temporary repository with a time-to-live of 10 minutes.

Return Type
String !
Example
func (m *myModule) example(ctx context.Context) string  {
	return dag.
			ContainerImage().
			FakePublishFromRepo(ctx)
}
@function
async def example() -> str:
	return await (
		dag.container_image()
		.fake_publish_from_repo()
	)
@func()
async example(): Promise<string> {
	return dag
		.containerImage()
		.fakePublishFromRepo()
}

imageTag() 🔗

ImageTag generates a Docker image tag based on the provided Git reference

Return Type
Container !
Example
func (m *myModule) example() *Container  {
	return dag.
			ContainerImage().
			ImageTag()
}
@function
def example() -> dagger.Container:
	return (
		dag.container_image()
		.image_tag()
	)
@func()
example(): Container {
	return dag
		.containerImage()
		.imageTag()
}