-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
519 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM --platform=$BUILDPLATFORM golang:1.21.6-alpine3.18 as initial | ||
ARG SLEEP_SECONDS | ||
RUN sleep ${SLEEP_SECONDS} && echo ${SLEEP_SECONDS} > output | ||
|
||
FROM alpine:3.18 as final | ||
COPY --from=initial /go/output output | ||
RUN cat output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: test-buildx-caching | ||
runtime: nodejs | ||
description: A minimal TypeScript Pulumi program |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import * as docker from "@pulumi/docker"; | ||
import * as pulumi from "@pulumi/pulumi"; | ||
|
||
const config = new pulumi.Config(); | ||
|
||
const start = new Date().getTime(); | ||
|
||
// docker buildx build \ | ||
// -f Dockerfile \ | ||
// --cache-to type=local,dest=tmp,mode=max,oci-mediatypes=true \ | ||
// --cache-from type=local,src=tmp \ | ||
// --build-arg SLEEP-MS=$SLEEP_MS \ | ||
// -t not-pushed \ | ||
// -f Dockerfile \ | ||
// --platform linux/arm64 \ | ||
// --platform linux/amd64 \ | ||
// . | ||
const img = new docker.buildx.Image(`buildx-${config.require("name")}`, { | ||
tags: ["not-pushed"], | ||
file: "Dockerfile", | ||
context: ".", | ||
platforms: ["linux/arm64", "linux/amd64"], | ||
buildArgs: { | ||
SLEEP_SECONDS: config.require("SLEEP_SECONDS"), | ||
}, | ||
cacheTo: [config.require("cacheTo")], | ||
cacheFrom: [config.require("cacheFrom")], | ||
// Set registry auth if it was provided. | ||
registries: config.getSecret("username").apply((a) => | ||
a | ||
? [ | ||
{ | ||
address: config.getSecret("address"), | ||
username: config.getSecret("username"), | ||
password: config.getSecret("password"), | ||
}, | ||
] | ||
: undefined | ||
), | ||
}); | ||
|
||
export const durationSeconds = img.manifests.apply( | ||
(_) => (new Date().getTime() - start) / 1000.0 | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "test-buildx-caching", | ||
"devDependencies": { | ||
"@types/node": "^20.0.0" | ||
}, | ||
"dependencies": { | ||
"@pulumi/pulumi": "^3.0.0" | ||
} | ||
} |
Oops, something went wrong.