diff --git a/cloudflared/Dockerfile b/cloudflared/Dockerfile new file mode 100644 index 0000000..92607cc --- /dev/null +++ b/cloudflared/Dockerfile @@ -0,0 +1,10 @@ +# syntax=docker/dockerfile:1 + +FROM --platform=$BUILDPLATFORM build as builder + +RUN --mount=type=cache,target=/gocache build-go cloudflared https://github.com/cloudflare/cloudflared.git 2023.5.0 ./cmd/cloudflared + +FROM scratch + +ARG TARGETARCH +COPY --from=builder /app/cloudflared-$TARGETARCH /usr/local/bin/cloudflared diff --git a/docker-bake.hcl b/docker-bake.hcl index f9ad630..d0f60ca 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -1,6 +1,7 @@ group "default" { targets = [ "build", + "cloudflared", "docker-buildx", "docker-cli", "docker-cli-full", @@ -24,6 +25,23 @@ target "build" { ] } +target "cloudflared" { + tags = [ + "ghcr.io/lutriseng/static-oci/cloudflared:latest", + "ghcr.io/lutriseng/static-oci/cloudflared:2023.5.0" + ] + cache-to = ["type=inline,mode=max"] + cache-from = ["ghcr.io/lutriseng/static-oci/cloudflared"] + context = "cloudflared" + contexts = { + build = "target:build" + } + platforms = [ + "linux/amd64", + "linux/arm64" + ] +} + target "docker-buildx" { tags = [ "ghcr.io/lutriseng/static-oci/docker-buildx:latest",