Skip to content

Commit

Permalink
Fix Container App py example (pulumi#1108)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhailshilkov authored Nov 2, 2021
1 parent b9d5ac3 commit 7fd20c4
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions azure-py-containerapps/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pulumi_azure_native import containerregistry
from pulumi_azure_native import operationalinsights
from pulumi_azure_native import resources
from pulumi_azure_native import web
import pulumi_azure_native.web.v20210301 as web
import pulumi_docker as docker

resource_group = resources.ResourceGroup("rg")
Expand Down Expand Up @@ -35,18 +35,17 @@
sku=containerregistry.SkuArgs(name="Basic"),
admin_user_enabled=True)

credentials = pulumi.Output.all(resource_group.name, registry.name) \
.apply(lambda args: containerregistry.list_registry_credentials(
resource_group_name=args[0],
registry_name=args[1]
))
admin_username = credentials.Apply(lambda c: c.username)
admin_password = credentials.Apply(lambda c: c.passwords[0])
credentials = pulumi.Output.all(resource_group.name, registry.name).apply(
lambda args: containerregistry.list_registry_credentials(resource_group_name=args[0],
registry_name=args[1]))
admin_username = credentials.username
admin_password = credentials.passwords[0]["value"]

custom_image = "node-app"
my_image = docker.Image(custom_image,
image_name=Output.concat(registry.login_server, "/", custom_image, ":v1.0.0"),
build=docker.DockerBuild(context = Output.concat("./", custom_image)),
image_name=registry.login_server.apply(
lambda login_server: f"{login_server}/{custom_image}:v1.0.0"),
build=docker.DockerBuild(context=f"./{custom_image}"),
registry=docker.ImageRegistry(
server=registry.login_server,
username=admin_username,
Expand Down

0 comments on commit 7fd20c4

Please sign in to comment.