Skip to content

Commit 5460e90

Browse files
committed
use ubuntu base for buildkit image
Signed-off-by: CrazyMax <[email protected]>
1 parent 7cf444e commit 5460e90

File tree

2 files changed

+31
-15
lines changed

2 files changed

+31
-15
lines changed

Dockerfile

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ ARG AZURITE_VERSION=3.33.0
1818
ARG GOTESTSUM_VERSION=v1.9.0
1919
ARG DELVE_VERSION=v1.23.1
2020

21-
ARG GO_VERSION=1.24
21+
ARG EXPORT_BASE=ubuntu
2222
ARG ALPINE_VERSION=3.21
23+
ARG UBUNTU_VERSION=24.04
24+
25+
ARG GO_VERSION=1.24
2326
ARG XX_VERSION=1.6.1
2427
ARG BUILDKIT_DEBUG
25-
ARG EXPORT_BASE=alpine
2628

2729
# minio for s3 integration tests
2830
FROM minio/minio:${MINIO_VERSION} AS minio
@@ -200,28 +202,26 @@ RUN --mount=from=binaries \
200202
FROM scratch AS release
201203
COPY --link --from=releaser /out/ /
202204

203-
FROM alpine:${ALPINE_VERSION} AS buildkit-export-alpine
204-
RUN apk add --no-cache fuse3 git openssh pigz xz iptables ip6tables \
205-
&& ln -s fusermount3 /usr/bin/fusermount
206-
COPY --link examples/buildctl-daemonless/buildctl-daemonless.sh /usr/bin/
207-
VOLUME /var/lib/buildkit
208-
209-
FROM ubuntu:24.04 AS buildkit-export-ubuntu
205+
FROM ubuntu:${UBUNTU_VERSION} AS buildkit-export-ubuntu
210206
RUN apt-get update \
211207
&& apt-get install -y --no-install-recommends \
208+
ca-certificates \
212209
fuse3 \
213210
git \
211+
iptables \
214212
openssh-client \
215213
pigz \
216214
xz-utils \
217-
iptables \
218-
ca-certificates \
219215
&& rm -rf /var/lib/apt/lists/*
220-
COPY --link examples/buildctl-daemonless/buildctl-daemonless.sh /usr/bin/
221-
VOLUME /var/lib/buildkit
216+
217+
FROM alpine:${ALPINE_VERSION} AS buildkit-export-alpine
218+
RUN apk add --no-cache fuse3 git openssh pigz xz iptables ip6tables \
219+
&& ln -s fusermount3 /usr/bin/fusermount
222220

223221
FROM buildkit-export-${EXPORT_BASE} AS buildkit-export
224222
RUN mkdir -p /etc/cdi /var/run/cdi /etc/buildkit/cdi
223+
COPY --link examples/buildctl-daemonless/buildctl-daemonless.sh /usr/bin/
224+
VOLUME /var/lib/buildkit
225225

226226
FROM gobuild-base AS containerd-build
227227
WORKDIR /go/src/github.com/containerd/containerd
@@ -456,13 +456,24 @@ ENV BUILDKIT_RUN_NETWORK_INTEGRATION_TESTS=1 BUILDKIT_CNI_INIT_LOCK_PATH=/run/bu
456456
FROM integration-tests AS dev-env
457457
VOLUME /var/lib/buildkit
458458

459-
# rootless builds a rootless variant of buildkitd image
460-
FROM alpine:${ALPINE_VERSION} AS rootless
459+
FROM ubuntu:${UBUNTU_VERSION} AS rootless-ubuntu
460+
RUN apt-get update \
461+
&& apt-get install -y --no-install-recommends fuse3 fuse-overlayfs git openssh-client pigz uidmap xz-utils \
462+
&& rm -rf /var/lib/apt/lists/*
463+
RUN adduser --disabled-password --gecos "" --uid 1000 user \
464+
&& mkdir -p /run/user/1000 /home/user/.local/tmp /home/user/.local/share/buildkit \
465+
&& chown -R user /run/user/1000 /home/user \
466+
&& echo user:100000:65536 | tee /etc/subuid | tee /etc/subgid
467+
468+
FROM alpine:${ALPINE_VERSION} AS rootless-alpine
461469
RUN apk add --no-cache fuse3 fuse-overlayfs git openssh pigz shadow-uidmap xz
462470
RUN adduser -D -u 1000 user \
463471
&& mkdir -p /run/user/1000 /home/user/.local/tmp /home/user/.local/share/buildkit \
464472
&& chown -R user /run/user/1000 /home/user \
465473
&& echo user:100000:65536 | tee /etc/subuid | tee /etc/subgid
474+
475+
# rootless builds a rootless variant of buildkitd image
476+
FROM rootless-${EXPORT_BASE} AS rootless
466477
COPY --link --from=rootlesskit /rootlesskit /usr/bin/
467478
COPY --link --from=binaries / /usr/bin/
468479
COPY --link examples/buildctl-daemonless/buildctl-daemonless.sh /usr/bin/

docker-bake.hcl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
variable "UBUNTU_VERSION" {
2+
default = null
3+
}
4+
15
variable "ALPINE_VERSION" {
26
default = null
37
}
@@ -76,6 +80,7 @@ function "bindir" {
7680

7781
target "_common" {
7882
args = {
83+
UBUNTU_VERSION = UBUNTU_VERSION
7984
ALPINE_VERSION = ALPINE_VERSION
8085
GO_VERSION = GO_VERSION
8186
NODE_VERSION = NODE_VERSION

0 commit comments

Comments
 (0)