Update examples and docs for required push

This commit is contained in:
Bryce Lampe
2024-04-25 09:51:24 -07:00
parent f8796f9095
commit 13fb5b6158
8 changed files with 196 additions and 33 deletions

View File

@@ -9,6 +9,7 @@ return await Deployment.RunAsync(() =>
var dockerHubPassword = config.Require("dockerHubPassword");
var multiPlatform = new DockerBuild.Image("multiPlatform", new()
{
Push = false,
Dockerfile = new DockerBuild.Inputs.DockerfileArgs
{
Location = "./app/Dockerfile.multiPlatform",
@@ -26,6 +27,7 @@ return await Deployment.RunAsync(() =>
var registryPush = new DockerBuild.Image("registryPush", new()
{
Push = false,
Context = new DockerBuild.Inputs.BuildContextArgs
{
Location = "./app",
@@ -58,6 +60,7 @@ return await Deployment.RunAsync(() =>
var cached = new DockerBuild.Image("cached", new()
{
Push = false,
Context = new DockerBuild.Inputs.BuildContextArgs
{
Location = "./app",
@@ -87,6 +90,7 @@ return await Deployment.RunAsync(() =>
var buildArgs = new DockerBuild.Image("buildArgs", new()
{
Push = false,
Dockerfile = new DockerBuild.Inputs.DockerfileArgs
{
Location = "./app/Dockerfile.buildArgs",
@@ -103,6 +107,7 @@ return await Deployment.RunAsync(() =>
var extraHosts = new DockerBuild.Image("extraHosts", new()
{
Push = false,
Dockerfile = new DockerBuild.Inputs.DockerfileArgs
{
Location = "./app/Dockerfile.extraHosts",
@@ -119,6 +124,7 @@ return await Deployment.RunAsync(() =>
var sshMount = new DockerBuild.Image("sshMount", new()
{
Push = false,
Dockerfile = new DockerBuild.Inputs.DockerfileArgs
{
Location = "./app/Dockerfile.sshMount",
@@ -138,6 +144,7 @@ return await Deployment.RunAsync(() =>
var secrets = new DockerBuild.Image("secrets", new()
{
Push = false,
Dockerfile = new DockerBuild.Inputs.DockerfileArgs
{
Location = "./app/Dockerfile.secrets",
@@ -154,6 +161,7 @@ return await Deployment.RunAsync(() =>
var labels = new DockerBuild.Image("labels", new()
{
Push = false,
Context = new DockerBuild.Inputs.BuildContextArgs
{
Location = "./app",
@@ -166,6 +174,7 @@ return await Deployment.RunAsync(() =>
var target = new DockerBuild.Image("target", new()
{
Push = false,
Dockerfile = new DockerBuild.Inputs.DockerfileArgs
{
Location = "./app/Dockerfile.target",
@@ -179,6 +188,7 @@ return await Deployment.RunAsync(() =>
var namedContexts = new DockerBuild.Image("namedContexts", new()
{
Push = false,
Dockerfile = new DockerBuild.Inputs.DockerfileArgs
{
Location = "./app/Dockerfile.namedContexts",
@@ -198,6 +208,7 @@ return await Deployment.RunAsync(() =>
var remoteContext = new DockerBuild.Image("remoteContext", new()
{
Push = false,
Context = new DockerBuild.Inputs.BuildContextArgs
{
Location = "https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile",
@@ -206,6 +217,7 @@ return await Deployment.RunAsync(() =>
var remoteContextWithInline = new DockerBuild.Image("remoteContextWithInline", new()
{
Push = false,
Dockerfile = new DockerBuild.Inputs.DockerfileArgs
{
Inline = @"FROM busybox
@@ -220,6 +232,7 @@ COPY hello.c ./
var inline = new DockerBuild.Image("inline", new()
{
Push = false,
Dockerfile = new DockerBuild.Inputs.DockerfileArgs
{
Inline = @"FROM alpine
@@ -234,6 +247,7 @@ RUN echo ""This uses an inline Dockerfile! 👍""
var dockerLoad = new DockerBuild.Image("dockerLoad", new()
{
Push = false,
Context = new DockerBuild.Inputs.BuildContextArgs
{
Location = "./app",

View File

@@ -11,6 +11,7 @@ func main() {
cfg := config.New(ctx, "")
dockerHubPassword := cfg.Require("dockerHubPassword")
multiPlatform, err := dockerbuild.NewImage(ctx, "multiPlatform", &dockerbuild.ImageArgs{
Push: pulumi.Bool(false),
Dockerfile: &dockerbuild.DockerfileArgs{
Location: pulumi.String("./app/Dockerfile.multiPlatform"),
},
@@ -26,6 +27,7 @@ func main() {
return err
}
_, err = dockerbuild.NewImage(ctx, "registryPush", &dockerbuild.ImageArgs{
Push: pulumi.Bool(false),
Context: &dockerbuild.BuildContextArgs{
Location: pulumi.String("./app"),
},
@@ -52,6 +54,7 @@ func main() {
return err
}
_, err = dockerbuild.NewImage(ctx, "cached", &dockerbuild.ImageArgs{
Push: pulumi.Bool(false),
Context: &dockerbuild.BuildContextArgs{
Location: pulumi.String("./app"),
},
@@ -75,6 +78,7 @@ func main() {
return err
}
_, err = dockerbuild.NewImage(ctx, "buildArgs", &dockerbuild.ImageArgs{
Push: pulumi.Bool(false),
Dockerfile: &dockerbuild.DockerfileArgs{
Location: pulumi.String("./app/Dockerfile.buildArgs"),
},
@@ -89,6 +93,7 @@ func main() {
return err
}
_, err = dockerbuild.NewImage(ctx, "extraHosts", &dockerbuild.ImageArgs{
Push: pulumi.Bool(false),
Dockerfile: &dockerbuild.DockerfileArgs{
Location: pulumi.String("./app/Dockerfile.extraHosts"),
},
@@ -103,6 +108,7 @@ func main() {
return err
}
_, err = dockerbuild.NewImage(ctx, "sshMount", &dockerbuild.ImageArgs{
Push: pulumi.Bool(false),
Dockerfile: &dockerbuild.DockerfileArgs{
Location: pulumi.String("./app/Dockerfile.sshMount"),
},
@@ -119,6 +125,7 @@ func main() {
return err
}
_, err = dockerbuild.NewImage(ctx, "secrets", &dockerbuild.ImageArgs{
Push: pulumi.Bool(false),
Dockerfile: &dockerbuild.DockerfileArgs{
Location: pulumi.String("./app/Dockerfile.secrets"),
},
@@ -133,6 +140,7 @@ func main() {
return err
}
_, err = dockerbuild.NewImage(ctx, "labels", &dockerbuild.ImageArgs{
Push: pulumi.Bool(false),
Context: &dockerbuild.BuildContextArgs{
Location: pulumi.String("./app"),
},
@@ -144,6 +152,7 @@ func main() {
return err
}
_, err = dockerbuild.NewImage(ctx, "target", &dockerbuild.ImageArgs{
Push: pulumi.Bool(false),
Dockerfile: &dockerbuild.DockerfileArgs{
Location: pulumi.String("./app/Dockerfile.target"),
},
@@ -156,6 +165,7 @@ func main() {
return err
}
_, err = dockerbuild.NewImage(ctx, "namedContexts", &dockerbuild.ImageArgs{
Push: pulumi.Bool(false),
Dockerfile: &dockerbuild.DockerfileArgs{
Location: pulumi.String("./app/Dockerfile.namedContexts"),
},
@@ -172,6 +182,7 @@ func main() {
return err
}
_, err = dockerbuild.NewImage(ctx, "remoteContext", &dockerbuild.ImageArgs{
Push: pulumi.Bool(false),
Context: &dockerbuild.BuildContextArgs{
Location: pulumi.String("https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile"),
},
@@ -180,6 +191,7 @@ func main() {
return err
}
_, err = dockerbuild.NewImage(ctx, "remoteContextWithInline", &dockerbuild.ImageArgs{
Push: pulumi.Bool(false),
Dockerfile: &dockerbuild.DockerfileArgs{
Inline: pulumi.String("FROM busybox\nCOPY hello.c ./\n"),
},
@@ -191,6 +203,7 @@ func main() {
return err
}
_, err = dockerbuild.NewImage(ctx, "inline", &dockerbuild.ImageArgs{
Push: pulumi.Bool(false),
Dockerfile: &dockerbuild.DockerfileArgs{
Inline: pulumi.String("FROM alpine\nRUN echo \"This uses an inline Dockerfile! 👍\"\n"),
},
@@ -202,6 +215,7 @@ func main() {
return err
}
_, err = dockerbuild.NewImage(ctx, "dockerLoad", &dockerbuild.ImageArgs{
Push: pulumi.Bool(false),
Context: &dockerbuild.BuildContextArgs{
Location: pulumi.String("./app"),
},

View File

@@ -32,6 +32,7 @@ public class App {
final var config = ctx.config();
final var dockerHubPassword = config.get("dockerHubPassword");
var multiPlatform = new Image("multiPlatform", ImageArgs.builder()
.push(false)
.dockerfile(DockerfileArgs.builder()
.location("./app/Dockerfile.multiPlatform")
.build())
@@ -44,6 +45,7 @@ public class App {
.build());
var registryPush = new Image("registryPush", ImageArgs.builder()
.push(false)
.context(BuildContextArgs.builder()
.location("./app")
.build())
@@ -62,6 +64,7 @@ public class App {
.build());
var cached = new Image("cached", ImageArgs.builder()
.push(false)
.context(BuildContextArgs.builder()
.location("./app")
.build())
@@ -79,6 +82,7 @@ public class App {
.build());
var buildArgs = new Image("buildArgs", ImageArgs.builder()
.push(false)
.dockerfile(DockerfileArgs.builder()
.location("./app/Dockerfile.buildArgs")
.build())
@@ -89,6 +93,7 @@ public class App {
.build());
var extraHosts = new Image("extraHosts", ImageArgs.builder()
.push(false)
.dockerfile(DockerfileArgs.builder()
.location("./app/Dockerfile.extraHosts")
.build())
@@ -99,6 +104,7 @@ public class App {
.build());
var sshMount = new Image("sshMount", ImageArgs.builder()
.push(false)
.dockerfile(DockerfileArgs.builder()
.location("./app/Dockerfile.sshMount")
.build())
@@ -111,6 +117,7 @@ public class App {
.build());
var secrets = new Image("secrets", ImageArgs.builder()
.push(false)
.dockerfile(DockerfileArgs.builder()
.location("./app/Dockerfile.secrets")
.build())
@@ -121,6 +128,7 @@ public class App {
.build());
var labels = new Image("labels", ImageArgs.builder()
.push(false)
.context(BuildContextArgs.builder()
.location("./app")
.build())
@@ -128,6 +136,7 @@ public class App {
.build());
var target = new Image("target", ImageArgs.builder()
.push(false)
.dockerfile(DockerfileArgs.builder()
.location("./app/Dockerfile.target")
.build())
@@ -138,6 +147,7 @@ public class App {
.build());
var namedContexts = new Image("namedContexts", ImageArgs.builder()
.push(false)
.dockerfile(DockerfileArgs.builder()
.location("./app/Dockerfile.namedContexts")
.build())
@@ -148,12 +158,14 @@ public class App {
.build());
var remoteContext = new Image("remoteContext", ImageArgs.builder()
.push(false)
.context(BuildContextArgs.builder()
.location("https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile")
.build())
.build());
var remoteContextWithInline = new Image("remoteContextWithInline", ImageArgs.builder()
.push(false)
.dockerfile(DockerfileArgs.builder()
.inline("""
FROM busybox
@@ -166,6 +178,7 @@ COPY hello.c ./
.build());
var inline = new Image("inline", ImageArgs.builder()
.push(false)
.dockerfile(DockerfileArgs.builder()
.inline("""
FROM alpine
@@ -178,6 +191,7 @@ RUN echo "This uses an inline Dockerfile! 👍"
.build());
var dockerLoad = new Image("dockerLoad", ImageArgs.builder()
.push(false)
.context(BuildContextArgs.builder()
.location("./app")
.build())

View File

@@ -4,6 +4,7 @@ import * as docker_build from "@pulumi/docker-build";
const config = new pulumi.Config();
const dockerHubPassword = config.require("dockerHubPassword");
const multiPlatform = new docker_build.Image("multiPlatform", {
push: false,
dockerfile: {
location: "./app/Dockerfile.multiPlatform",
},
@@ -16,6 +17,7 @@ const multiPlatform = new docker_build.Image("multiPlatform", {
],
});
const registryPush = new docker_build.Image("registryPush", {
push: false,
context: {
location: "./app",
},
@@ -33,6 +35,7 @@ const registryPush = new docker_build.Image("registryPush", {
}],
});
const cached = new docker_build.Image("cached", {
push: false,
context: {
location: "./app",
},
@@ -49,6 +52,7 @@ const cached = new docker_build.Image("cached", {
}],
});
const buildArgs = new docker_build.Image("buildArgs", {
push: false,
dockerfile: {
location: "./app/Dockerfile.buildArgs",
},
@@ -60,6 +64,7 @@ const buildArgs = new docker_build.Image("buildArgs", {
},
});
const extraHosts = new docker_build.Image("extraHosts", {
push: false,
dockerfile: {
location: "./app/Dockerfile.extraHosts",
},
@@ -69,6 +74,7 @@ const extraHosts = new docker_build.Image("extraHosts", {
addHosts: ["metadata.google.internal:169.254.169.254"],
});
const sshMount = new docker_build.Image("sshMount", {
push: false,
dockerfile: {
location: "./app/Dockerfile.sshMount",
},
@@ -80,6 +86,7 @@ const sshMount = new docker_build.Image("sshMount", {
}],
});
const secrets = new docker_build.Image("secrets", {
push: false,
dockerfile: {
location: "./app/Dockerfile.secrets",
},
@@ -91,6 +98,7 @@ const secrets = new docker_build.Image("secrets", {
},
});
const labels = new docker_build.Image("labels", {
push: false,
context: {
location: "./app",
},
@@ -99,6 +107,7 @@ const labels = new docker_build.Image("labels", {
},
});
const target = new docker_build.Image("target", {
push: false,
dockerfile: {
location: "./app/Dockerfile.target",
},
@@ -108,6 +117,7 @@ const target = new docker_build.Image("target", {
target: "build-me",
});
const namedContexts = new docker_build.Image("namedContexts", {
push: false,
dockerfile: {
location: "./app/Dockerfile.namedContexts",
},
@@ -120,10 +130,14 @@ const namedContexts = new docker_build.Image("namedContexts", {
},
},
});
const remoteContext = new docker_build.Image("remoteContext", {context: {
location: "https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile",
}});
const remoteContext = new docker_build.Image("remoteContext", {
push: false,
context: {
location: "https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile",
},
});
const remoteContextWithInline = new docker_build.Image("remoteContextWithInline", {
push: false,
dockerfile: {
inline: `FROM busybox
COPY hello.c ./
@@ -134,6 +148,7 @@ COPY hello.c ./
},
});
const inline = new docker_build.Image("inline", {
push: false,
dockerfile: {
inline: `FROM alpine
RUN echo "This uses an inline Dockerfile! 👍"
@@ -144,6 +159,7 @@ RUN echo "This uses an inline Dockerfile! 👍"
},
});
const dockerLoad = new docker_build.Image("dockerLoad", {
push: false,
context: {
location: "./app",
},

View File

@@ -4,6 +4,7 @@ import pulumi_docker_build as docker_build
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",
),
@@ -15,6 +16,7 @@ multi_platform = docker_build.Image("multiPlatform",
docker_build.Platform.PLAN9_386,
])
registry_push = docker_build.Image("registryPush",
push=False,
context=docker_build.BuildContextArgs(
location="./app",
),
@@ -31,6 +33,7 @@ registry_push = docker_build.Image("registryPush",
password=docker_hub_password,
)])
cached = docker_build.Image("cached",
push=False,
context=docker_build.BuildContextArgs(
location="./app",
),
@@ -46,6 +49,7 @@ cached = docker_build.Image("cached",
),
)])
build_args = docker_build.Image("buildArgs",
push=False,
dockerfile=docker_build.DockerfileArgs(
location="./app/Dockerfile.buildArgs",
),
@@ -56,6 +60,7 @@ build_args = docker_build.Image("buildArgs",
"SET_ME_TO_TRUE": "true",
})
extra_hosts = docker_build.Image("extraHosts",
push=False,
dockerfile=docker_build.DockerfileArgs(
location="./app/Dockerfile.extraHosts",
),
@@ -64,6 +69,7 @@ extra_hosts = docker_build.Image("extraHosts",
),
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",
),
@@ -74,6 +80,7 @@ ssh_mount = docker_build.Image("sshMount",
id="default",
)])
secrets = docker_build.Image("secrets",
push=False,
dockerfile=docker_build.DockerfileArgs(
location="./app/Dockerfile.secrets",
),
@@ -84,6 +91,7 @@ secrets = docker_build.Image("secrets",
"password": "hunter2",
})
labels = docker_build.Image("labels",
push=False,
context=docker_build.BuildContextArgs(
location="./app",
),
@@ -91,6 +99,7 @@ labels = docker_build.Image("labels",
"description": "This image will get a descriptive label 👍",
})
target = docker_build.Image("target",
push=False,
dockerfile=docker_build.DockerfileArgs(
location="./app/Dockerfile.target",
),
@@ -99,6 +108,7 @@ target = docker_build.Image("target",
),
target="build-me")
named_contexts = docker_build.Image("namedContexts",
push=False,
dockerfile=docker_build.DockerfileArgs(
location="./app/Dockerfile.namedContexts",
),
@@ -110,10 +120,13 @@ named_contexts = docker_build.Image("namedContexts",
),
},
))
remote_context = docker_build.Image("remoteContext", context=docker_build.BuildContextArgs(
location="https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile",
))
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",
))
remote_context_with_inline = docker_build.Image("remoteContextWithInline",
push=False,
dockerfile=docker_build.DockerfileArgs(
inline="""FROM busybox
COPY hello.c ./
@@ -123,6 +136,7 @@ COPY hello.c ./
location="https://github.com/docker-library/hello-world.git",
))
inline = docker_build.Image("inline",
push=False,
dockerfile=docker_build.DockerfileArgs(
inline="""FROM alpine
RUN echo "This uses an inline Dockerfile! 👍"
@@ -132,6 +146,7 @@ RUN echo "This uses an inline Dockerfile! 👍"
location="./app",
))
docker_load = docker_build.Image("dockerLoad",
push=False,
context=docker_build.BuildContextArgs(
location="./app",
),

View File

@@ -10,6 +10,7 @@ resources:
multiPlatform:
type: docker-build:Image
properties:
push: false
dockerfile:
location: "./app/Dockerfile.multiPlatform"
context:
@@ -22,6 +23,7 @@ resources:
registryPush:
type: docker-build:Image
properties:
push: false
context:
location: "./app"
tags: ["docker.io/pulumibot/buildkit-e2e:example"]
@@ -38,6 +40,7 @@ resources:
cached:
type: docker-build:Image
properties:
push: false
context:
location: "./app"
cacheTo:
@@ -52,6 +55,7 @@ resources:
buildArgs:
type: docker-build:Image
properties:
push: false
dockerfile:
location: "./app/Dockerfile.buildArgs"
context:
@@ -63,6 +67,7 @@ resources:
extraHosts:
type: docker-build:Image
properties:
push: false
dockerfile:
location: "./app/Dockerfile.extraHosts"
context:
@@ -74,6 +79,7 @@ resources:
sshMount:
type: docker-build:Image
properties:
push: false
dockerfile:
location: "./app/Dockerfile.sshMount"
context:
@@ -85,6 +91,7 @@ resources:
secrets:
type: docker-build:Image
properties:
push: false
dockerfile:
location: "./app/Dockerfile.secrets"
context:
@@ -96,6 +103,7 @@ resources:
labels:
type: docker-build:Image
properties:
push: false
context:
location: "./app"
labels:
@@ -105,6 +113,7 @@ resources:
target:
type: docker-build:Image
properties:
push: false
dockerfile:
location: "./app/Dockerfile.target"
context:
@@ -116,6 +125,7 @@ resources:
namedContexts:
type: docker-build:Image
properties:
push: false
dockerfile:
location: "./app/Dockerfile.namedContexts"
context:
@@ -128,6 +138,7 @@ resources:
remoteContext:
type: docker-build:Image
properties:
push: false
context:
location: "https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile"
@@ -138,6 +149,7 @@ resources:
remoteContextWithInline:
type: docker-build:Image
properties:
push: false
dockerfile:
inline: |
FROM busybox
@@ -149,6 +161,7 @@ resources:
inline:
type: docker-build:Image
properties:
push: false
dockerfile:
inline: |
FROM alpine
@@ -160,6 +173,7 @@ resources:
dockerLoad:
type: docker-build:Image
properties:
push: false
context:
location: "./app"
exports: