MCPcopy Create free account
hub / github.com/aws-samples/aws-cdk-examples / __init__

Method __init__

python/ecs-serviceconnect/ecr/ecr_stack.py:12–46  ·  view source on GitHub ↗
(self, scope: Construct, id: str, **kwargs, )

Source from the content-addressed store, hash-verified

10class EcrStack(NestedStack):
11
12 def __init__(self, scope: Construct, id: str, **kwargs, ) -> None:
13 super().__init__(scope, id, **kwargs )
14 # Creates two ecr repositories that will host the docker images for the color teller gateway app and color teller app
15 FrontendRepository = ecr.Repository(self, "FrontendRepository", repository_name="frontend")
16 BackendDataRepository = ecr.Repository(self, "BackendDataRepository", repository_name="backend_data")
17
18 # The docker images were built on a M1 Macbook Pro, you may have to rebuild your images
19 frontendAsset = DockerImageAsset(self, "frontendAsset",
20 directory="./services/frontend",
21 build_args={
22 "SERVICE_B_URL_BUILD_ARG": "data.scapp.local" # This argument will be passed to the dockerfile and is the URL that the frontend app will use to call the backend
23 },
24
25 platform=Platform.LINUX_AMD64
26 )
27 dataAsset = DockerImageAsset(self, "dataAsset",
28 directory="./services/data",
29
30 )
31 # Deploying images to ECR
32 ecrdeploy.ECRDeployment(self, "DeployFrontendImage",
33 src=ecrdeploy.DockerImageName(frontendAsset.image_uri),
34 dest=ecrdeploy.DockerImageName(f"{Aws.ACCOUNT_ID}.dkr.ecr.{Aws.REGION}.amazonaws.com/frontend:latest")
35 )
36
37
38
39 ecrdeploy.ECRDeployment(self, "DeployBackendImage",
40 src=ecrdeploy.DockerImageName(dataAsset.image_uri),
41 dest=ecrdeploy.DockerImageName(f"{Aws.ACCOUNT_ID}.dkr.ecr.{Aws.REGION}.amazonaws.com/backend_data:latest")
42 )
43
44 # Exporting values to be used in other stacks
45 self.frontend_docker_asset = frontendAsset
46 self.backend_data_docker_asset = dataAsset

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected