Experimental
@aws-cdk/aws-apprunner-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
AssetProps Struct
Properties of the image repository for Source.fromAsset().
| Stability | Experimental |
|---|---|
| Source | lib/service.ts |
Example
ts
import * as assets from 'aws-cdk-lib/aws-ecr-assets';
const imageAsset = new assets.DockerImageAsset(this, 'ImageAssets', {
directory: path.join(__dirname, 'docker.assets'),
});
new apprunner.Service(this, 'Service', {
source: apprunner.Source.fromAsset({
imageConfiguration: { port: 8000 },
asset: imageAsset,
}),
autoDeploymentsEnabled: true,
});
python
import aws_cdk.aws_ecr_assets as assets
image_asset = assets.DockerImageAsset(self, "ImageAssets",
directory=path.join(__dirname, "docker.assets")
)
apprunner.Service(self, "Service",
source=apprunner.Source.from_asset(
image_configuration=apprunner.ImageConfiguration(port=8000),
asset=image_asset
),
auto_deployments_enabled=True
)
java
import software.amazon.awscdk.services.ecr.assets.*;
DockerImageAsset imageAsset = DockerImageAsset.Builder.create(this, "ImageAssets")
.directory(join(__dirname, "docker.assets"))
.build();
Service.Builder.create(this, "Service")
.source(Source.fromAsset(AssetProps.builder()
.imageConfiguration(ImageConfiguration.builder().port(8000).build())
.asset(imageAsset)
.build()))
.autoDeploymentsEnabled(true)
.build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.AppRunner.Alpha
using Amazon.CDK.AWS.Ecr.Assets;
var imageAsset = new DockerImageAsset(this, "ImageAssets", new DockerImageAssetProps {
Directory = Join(__dirname, "docker.assets")
});
new Service(this, "Service", new ServiceProps {
Source = Source.FromAsset(new AssetProps {
ImageConfiguration = new ImageConfiguration { Port = 8000 },
Asset = imageAsset
}),
AutoDeploymentsEnabled = true
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkapprunneralpha/v2
import assets "github.com/aws/aws-cdk-go/awscdk"
imageAsset := assets.NewDockerImageAsset(this, jsii.String("ImageAssets"), &DockerImageAssetProps{
Directory: path.join(__dirname, jsii.String("docker.assets")),
})
apprunner.NewService(this, jsii.String("Service"), &ServiceProps{
Source: apprunner.Source_FromAsset(&AssetProps{
ImageConfiguration: &ImageConfiguration{
Port: jsii.Number(8000),
},
Asset: imageAsset,
}),
AutoDeploymentsEnabled: jsii.Boolean(true),
})
Properties
assetDockerImageAssetassetDockerImageAssetassetDockerImageAssetAssetDockerImageAssetAssetDockerImageAsset required #Represents the docker image asset.
imageConfigurationoptionalImageConfigurationimage_configurationoptionalImageConfigurationimageConfigurationoptionalImageConfigurationImageConfigurationoptionalImageConfigurationImageConfigurationoptionalImageConfiguration #The image configuration for the image built from the asset.
Default: no image configuration will be passed. The default port will be 8080.