ContainerResource
A resource that represents a specified container.
type ContainerResource interface { IComputeResource Resource ResourceWithArgs ResourceWithEndpoints ResourceWithEnvironment ResourceWithWaitSupport}Methods
PublishAsConnectionString() ContainerResourceReturns
ContainerResource The resource builder.
Returns a handle; failures surface later via Err().
PublishAsContainer() ContainerResourceReturns
ContainerResource The resource builder.
Returns a handle; failures surface later via Err().
WithBindMount( source string, target string, options ...*WithBindMountOptions,) ContainerResourceParameters
sourcestringThe source path of the mount. This is the path to the file or directory on the host, relative to the AppHost project directory.targetstringThe target path where the file or directory is mounted in the container.options...*WithBindMountOptions Optional settings, described under Options.Options
Optional parameters are passed in a trailing options ...*WithBindMountOptions argument.
IsReadOnly *boolA flag that indicates if this is a read-only mount.Returns
ContainerResource The resource builder.
Returns a handle; failures surface later via Err().
WithBuildArg( name string, value any,) ContainerResourceParameters
namestringThe name of the build argument.valueanyThe build argument value, either a string or a parameter resource.Returns
ContainerResource The resource builder.
Returns a handle; failures surface later via Err().
WithBuildSecret( name string, value ParameterResource,) ContainerResourceParameters
namestringThe name of the secret build argument.valueParameterResource The resource builder for a parameter resource.Returns
ContainerResource The resource builder.
Returns a handle; failures surface later via Err().
WithContainerCertificatePaths(options ...*WithContainerCertificatePathsOptions) ContainerResourceParameters
options...*WithContainerCertificatePathsOptions Optional settings, described under Options.Options
Optional parameters are passed in a trailing options ...*WithContainerCertificatePathsOptions argument.
CustomCertificatesDestination *stringThe destination path in the container where custom certificates will be copied.DefaultCertificateBundlePaths []string Default certificate bundle paths in the container that will be replaced.DefaultCertificateDirectoryPaths []string Default certificate directory paths in the container that may be appended.Returns
ContainerResource The updated resource builder.
Returns a handle; failures surface later via Err().
WithContainerFiles( destinationPath string, sourcePath string, options ...*ContainerFilesOptions,) ContainerResourceParameters
destinationPath stringThe destination absolute path in the container.sourcePath stringThe source path on the host to copy files from.options...*ContainerFilesOptions Optional settings, described under Options.Options
Optional parameters are passed as the existing *ContainerFilesOptions struct.
Returns
ContainerResource The resource builder.
Returns a handle; failures surface later via Err().
WithContainerFilesCallback( destinationPath string, callback func(arg1 ContainerFileSystemCallbackContext, arg2 *CancellationToken) []ContainerFileSystemItem, options ...*ContainerFilesOptions,) ContainerResourceParameters
destinationPath stringThe destination absolute path in the container.callbackfunc(arg1 ContainerFileSystemCallbackContext, arg2 *CancellationToken) []ContainerFileSystemItem callbackA callback that returns the file system entries to create or update. Use the factory methods on ContainerFileSystemCallbackContext (createFile, createDirectory, createCertificateFile) to build the entries.options...*ContainerFilesOptions Optional settings, described under Options.Options
Optional parameters are passed as the existing *ContainerFilesOptions struct.
Returns
ContainerResource The resource builder.
Returns a handle; failures surface later via Err().
WithContainerName(name string) ContainerResourceParameters
namestringThe desired container name. Must be a valid container name or your runtime will report an error.Returns
ContainerResource The resource builder.
Returns a handle; failures surface later via Err().
WithContainerNetworkAlias(alias string) ContainerResourceParameters
aliasstringThe network alias for the container.Returns
ContainerResource The resource builder.
Returns a handle; failures surface later via Err().
WithContainerRuntimeArgs(args []string) ContainerResourceParameters
args[]string The arguments to be passed to the container runtime run command when the container resource is started.Returns
ContainerResource The resource builder.
Returns a handle; failures surface later via Err().
WithDockerfile( contextPath string, options ...*WithDockerfileOptions,) ContainerResourceParameters
contextPath stringPath to be used as the context for the container image build.options...*WithDockerfileOptions Optional settings, described under Options.Options
Optional parameters are passed in a trailing options ...*WithDockerfileOptions argument.
DockerfilePath *stringPath to the Dockerfile relative to the contextPath . Defaults to "Dockerfile" if not specified.Stage*stringThe stage representing the image to be published in a multi-stage Dockerfile.Returns
ContainerResource The resource builder.
Returns a handle; failures surface later via Err().
WithDockerfileBuilder( contextPath string, callback func(arg DockerfileBuilderCallbackContext), options ...*WithDockerfileBuilderOptions,) ContainerResourceParameters
contextPath stringPath to be used as the context for the container image build.callbackfunc(arg DockerfileBuilderCallbackContext) callbackA callback that uses the DockerfileBuilder API to construct the Dockerfile.options...*WithDockerfileBuilderOptions Optional settings, described under Options.Options
Optional parameters are passed in a trailing options ...*WithDockerfileBuilderOptions argument.
Stage*stringThe stage representing the image to be published in a multi-stage Dockerfile.Returns
ContainerResource The resource builder.
Returns a handle; failures surface later via Err().
WithDockerfileFactory( contextPath string, dockerfileFactory func(arg DockerfileFactoryContext) string, options ...*WithDockerfileFactoryOptions,) ContainerResourceParameters
contextPath stringPath to be used as the context for the container image build.dockerfileFactory func(arg DockerfileFactoryContext) string callbackAn asynchronous function that returns the Dockerfile content as a string.options...*WithDockerfileFactoryOptions Optional settings, described under Options.Options
Optional parameters are passed in a trailing options ...*WithDockerfileFactoryOptions argument.
Stage*stringThe stage representing the image to be published in a multi-stage Dockerfile.Returns
ContainerResource The resource builder.
Returns a handle; failures surface later via Err().
WithEntrypoint(entrypoint string) ContainerResourceParameters
entrypointstringThe new entrypoint for the container.Returns
ContainerResource The resource builder.
Returns a handle; failures surface later via Err().
WithImage( image string, options ...*WithImageOptions,) ContainerResourceParameters
imagestringImage value.options...*WithImageOptions Optional settings, described under Options.Options
Optional parameters are passed in a trailing options ...*WithImageOptions argument.
Tag*stringTag value.Returns
ContainerResource The resource builder.
Returns a handle; failures surface later via Err().
WithImagePullPolicy(pullPolicy ImagePullPolicy) ContainerResourceParameters
pullPolicy ImagePullPolicy The pull policy behavior for the container resource.Returns
ContainerResource The resource builder.
Returns a handle; failures surface later via Err().
WithImageRegistry(registry string) ContainerResourceParameters
registrystringRegistry value.Returns
ContainerResource The resource builder.
Returns a handle; failures surface later via Err().
WithImageSHA256(sha256 string) ContainerResourceParameters
sha256stringRegistry value.Returns
ContainerResource The resource builder.
Returns a handle; failures surface later via Err().
WithImageTag(tag string) ContainerResourceParameters
tagstringTag value.Returns
ContainerResource The resource builder.
Returns a handle; failures surface later via Err().
WithLifetime(lifetime ContainerLifetime) ContainerResourceParameters
lifetimeContainerLifetime The lifetime behavior of the container resource. The default behavior is Session.Returns
ContainerResource The resource builder.
Returns a handle; failures surface later via Err().
WithVolume( target string, options ...*WithVolumeOptions,) ContainerResourceParameters
targetstringThe mount path inside the container.options...*WithVolumeOptions Optional settings, described under Options.Options
Optional parameters are passed in a trailing options ...*WithVolumeOptions argument.
Name*stringThe volume name. If null, an anonymous volume is created.IsReadOnly *boolWhether the volume is read-only.Returns
ContainerResource The same resource builder handle for chaining.
Returns a handle; failures surface later via Err().