Changes for upcoming go-provider v1.0 (#525)

Fixes #535
This commit is contained in:
Bryce Lampe
2025-05-15 16:38:58 -07:00
committed by GitHub
parent a59206e63c
commit 4436ab5e76
22 changed files with 681 additions and 707 deletions

View File

@@ -5,151 +5,151 @@ config = pulumi.Config()
docker_hub_password = config.require("dockerHubPassword")
multi_platform = docker_build.Image("multiPlatform",
push=False,
dockerfile=docker_build.DockerfileArgs(
location="./app/Dockerfile.multiPlatform",
),
context=docker_build.BuildContextArgs(
location="./app",
),
dockerfile={
"location": "./app/Dockerfile.multiPlatform",
},
context={
"location": "./app",
},
platforms=[
docker_build.Platform.PLAN9_AMD64,
docker_build.Platform.PLAN9_386,
])
registry_push = docker_build.Image("registryPush",
push=False,
context=docker_build.BuildContextArgs(
location="./app",
),
context={
"location": "./app",
},
tags=["docker.io/pulumibot/buildkit-e2e:example"],
exports=[docker_build.ExportArgs(
registry=docker_build.ExportRegistryArgs(
oci_media_types=True,
push=False,
),
)],
registries=[docker_build.RegistryArgs(
address="docker.io",
username="pulumibot",
password=docker_hub_password,
)])
exports=[{
"registry": {
"oci_media_types": True,
"push": False,
},
}],
registries=[{
"address": "docker.io",
"username": "pulumibot",
"password": docker_hub_password,
}])
cached = docker_build.Image("cached",
push=False,
context=docker_build.BuildContextArgs(
location="./app",
),
cache_to=[docker_build.CacheToArgs(
local=docker_build.CacheToLocalArgs(
dest="tmp/cache",
mode=docker_build.CacheMode.MAX,
),
)],
cache_from=[docker_build.CacheFromArgs(
local=docker_build.CacheFromLocalArgs(
src="tmp/cache",
),
)])
context={
"location": "./app",
},
cache_to=[{
"local": {
"dest": "tmp/cache",
"mode": docker_build.CacheMode.MAX,
},
}],
cache_from=[{
"local": {
"src": "tmp/cache",
},
}])
build_args = docker_build.Image("buildArgs",
push=False,
dockerfile=docker_build.DockerfileArgs(
location="./app/Dockerfile.buildArgs",
),
context=docker_build.BuildContextArgs(
location="./app",
),
dockerfile={
"location": "./app/Dockerfile.buildArgs",
},
context={
"location": "./app",
},
build_args={
"SET_ME_TO_TRUE": "true",
})
extra_hosts = docker_build.Image("extraHosts",
push=False,
dockerfile=docker_build.DockerfileArgs(
location="./app/Dockerfile.extraHosts",
),
context=docker_build.BuildContextArgs(
location="./app",
),
dockerfile={
"location": "./app/Dockerfile.extraHosts",
},
context={
"location": "./app",
},
add_hosts=["metadata.google.internal:169.254.169.254"])
ssh_mount = docker_build.Image("sshMount",
push=False,
dockerfile=docker_build.DockerfileArgs(
location="./app/Dockerfile.sshMount",
),
context=docker_build.BuildContextArgs(
location="./app",
),
ssh=[docker_build.SSHArgs(
id="default",
)])
dockerfile={
"location": "./app/Dockerfile.sshMount",
},
context={
"location": "./app",
},
ssh=[{
"id": "default",
}])
secrets = docker_build.Image("secrets",
push=False,
dockerfile=docker_build.DockerfileArgs(
location="./app/Dockerfile.secrets",
),
context=docker_build.BuildContextArgs(
location="./app",
),
dockerfile={
"location": "./app/Dockerfile.secrets",
},
context={
"location": "./app",
},
secrets={
"password": "hunter2",
})
labels = docker_build.Image("labels",
push=False,
context=docker_build.BuildContextArgs(
location="./app",
),
context={
"location": "./app",
},
labels={
"description": "This image will get a descriptive label 👍",
})
target = docker_build.Image("target",
push=False,
dockerfile=docker_build.DockerfileArgs(
location="./app/Dockerfile.target",
),
context=docker_build.BuildContextArgs(
location="./app",
),
dockerfile={
"location": "./app/Dockerfile.target",
},
context={
"location": "./app",
},
target="build-me")
named_contexts = docker_build.Image("namedContexts",
push=False,
dockerfile=docker_build.DockerfileArgs(
location="./app/Dockerfile.namedContexts",
),
context=docker_build.BuildContextArgs(
location="./app",
named={
"golang:latest": docker_build.ContextArgs(
location="docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984",
),
dockerfile={
"location": "./app/Dockerfile.namedContexts",
},
context={
"location": "./app",
"named": {
"golang:latest": {
"location": "docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984",
},
},
))
})
remote_context = docker_build.Image("remoteContext",
push=False,
context=docker_build.BuildContextArgs(
location="https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile",
))
context={
"location": "https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile",
})
remote_context_with_inline = docker_build.Image("remoteContextWithInline",
push=False,
dockerfile=docker_build.DockerfileArgs(
inline="""FROM busybox
dockerfile={
"inline": """FROM busybox
COPY hello.c ./
""",
),
context=docker_build.BuildContextArgs(
location="https://github.com/docker-library/hello-world.git",
))
},
context={
"location": "https://github.com/docker-library/hello-world.git",
})
inline = docker_build.Image("inline",
push=False,
dockerfile=docker_build.DockerfileArgs(
inline="""FROM alpine
dockerfile={
"inline": """FROM alpine
RUN echo "This uses an inline Dockerfile! 👍"
""",
))
})
docker_load = docker_build.Image("dockerLoad",
push=False,
context=docker_build.BuildContextArgs(
location="./app",
),
exports=[docker_build.ExportArgs(
docker=docker_build.ExportDockerArgs(
tar=True,
),
)])
context={
"location": "./app",
},
exports=[{
"docker": {
"tar": True,
},
}])
pulumi.export("platforms", multi_platform.platforms)