Skip to content

Commit

Permalink
Add explicit 0.16 variant of BuildKit
Browse files Browse the repository at this point in the history
  • Loading branch information
tianon committed Oct 31, 2024
1 parent f50bf89 commit fc65f48
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 0 deletions.
88 changes: 88 additions & 0 deletions buildkit/Dockerfile.0.16
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#

FROM --platform=$BUILDPLATFORM golang:1.21 AS build

# https://github.com/moby/buildkit/releases
ENV BUILDKIT_VERSION 0.16.0

COPY \
backport-5372-sbom-args.patch \
backport-moby-48455-fix-riscv64-seccomp.patch \
containerd-arm64-v8.patch \
git-no-submodules.patch \
mips64le.patch \
noclip.patch \
nolint.patch \
/tmp/buildkit-patches/

WORKDIR /app

RUN set -eux; \
git clone --branch "v$BUILDKIT_VERSION" --depth 1 --config advice.detachedHead=false 'https://github.com/moby/buildkit.git' .; \
for patch in /tmp/buildkit-patches/*.patch; do \
git apply --verbose "$patch"; \
done; \
git diff --color

ENV CGO_ENABLED 0

ARG TARGETOS TARGETARCH TARGETVARIANT
ENV GOOS=$TARGETOS GOARCH=$TARGETARCH VARIANT=$TARGETVARIANT

RUN set -eux; \
case "$GOARCH/$VARIANT" in \
amd64/*) export GOAMD64="$VARIANT" ;; \
arm/*) export GOARM="${VARIANT#v}" ;; \
arm64/v8) ;; \
*) [ -z "$VARIANT" ] ;; \
esac; \
go env | grep -E 'OS=|ARCH=|AMD64=|ARM64=|ARM='; \
\
# https://github.com/moby/buildkit/blob/v0.13.2/Dockerfile#L93
pkg='github.com/moby/buildkit'; \
ldflags=" \
-d -w \
-X '$pkg/version.Version=$BUILDKIT_VERSION-tianon' \
-X '$pkg/version.Revision=v$BUILDKIT_VERSION+tianon-patches' \
-X '$pkg/version.Package=$pkg' \
"; \
go build -o /buildkitd -trimpath -ldflags "$ldflags" ./cmd/buildkitd; \
go build -o /buildctl -trimpath -ldflags "$ldflags" ./cmd/buildctl; \
\
# https://github.com/moby/buildkit/blob/v0.14.0/frontend/dockerfile/cmd/dockerfile-frontend/Dockerfile#L21
pkg='github.com/moby/buildkit/frontend/dockerfile/cmd/dockerfile-frontend'; \
ldflags=" \
-d -w \
-X '$pkg/version.Version=buildkit-$BUILDKIT_VERSION-tianon' \
-X '$pkg/version.Revision=v$BUILDKIT_VERSION+tianon-patches' \
-X '$pkg/version.Package=$pkg' \
"; \
go build -o /dockerfile-frontend -trimpath -ldflags "$ldflags" ./frontend/dockerfile/cmd/dockerfile-frontend

FROM --platform=$TARGETPLATFORM infosiftr/moby

RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends git; \
rm -rf /var/lib/apt/lists/*

COPY --from=build --link /buildkitd /buildctl /dockerfile-frontend /usr/local/bin/
COPY buildkitd-entrypoint.sh /usr/local/bin/

VOLUME /var/lib/buildkit

# https://github.com/docker/buildx/issues/484#issuecomment-749352728
ENV BUILDKIT_STEP_LOG_MAX_SIZE -1
ENV BUILDKIT_STEP_LOG_MAX_SPEED -1

# https://github.com/moby/buildkit/blob/v0.14.0/frontend/gateway/gateway.go#L309
# https://github.com/moby/buildkit/blob/v0.14.0/frontend/dockerfile/cmd/dockerfile-frontend/Dockerfile#L35-L36
LABEL moby.buildkit.frontend.network.none="true"
LABEL moby.buildkit.frontend.caps="moby.buildkit.frontend.inputs,moby.buildkit.frontend.subrequests,moby.buildkit.frontend.contexts"

ENTRYPOINT ["buildkitd-entrypoint.sh"]
CMD []
10 changes: 10 additions & 0 deletions buildkit/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"variants": [
"",
"rc",
"0.16",
"0.13"
],
"rc": {
Expand All @@ -20,6 +21,15 @@
"version": "1.22"
}
},
"0.16": {
"commit": "0865fcc9b78559e856e81dc52b3613701e7be28d",
"ref": "refs/tags/v0.16.0",
"tag": "v0.16.0",
"version": "0.16.0",
"go": {
"version": "1.21"
}
},
"0.13": {
"commit": "2e18d709fefdcc2db20853ee241c75b058189d39",
"ref": "refs/tags/v0.13.2",
Expand Down
1 change: 1 addition & 0 deletions buildkit/versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ variants=(
''
'rc'

'0.16'
'0.13'

# TODO add this back when I figure out a clean way to do something more akin to a "weekly snapshot" or something so it doesn't have an update every single day
Expand Down

0 comments on commit fc65f48

Please sign in to comment.