@@ -55,11 +55,13 @@ ARG KUBO_VERSION=v0.34.1
55
55
FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.6.1@sha256:923441d7c25f1e2eb5789f82d987693c47b8ed987c4ab3b075d6ed2b5d6779a3 AS xx
56
56
57
57
58
- FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-bookworm AS build-base-debian
58
+ FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-bookworm AS build-base
59
59
COPY --from=xx / /
60
60
ENV DEBIAN_FRONTEND=noninteractive
61
61
RUN apt-get update -qq && apt-get install -qq --no-install-recommends \
62
+ make \
62
63
git \
64
+ curl \
63
65
dpkg-dev
64
66
ARG TARGETARCH
65
67
# libbtrfs: for containerd
@@ -74,53 +76,53 @@ RUN xx-apt-get update -qq && xx-apt-get install -qq --no-install-recommends \
74
76
RUN git config --global advice.detachedHead false
75
77
ADD hack/git-checkout-tag-with-hash.sh /usr/local/bin/
76
78
77
- FROM build-base-debian AS build-containerd
79
+ FROM build-base AS build-containerd
78
80
ARG TARGETARCH
79
81
ARG CONTAINERD_VERSION
80
- RUN git clone --quiet --depth 1 --branch "${CONTAINERD_VERSION%@*}" https://github.com/containerd/containerd.git /go/src/github.com/containerd/containerd
82
+ RUN git clone --quiet --depth 1 --branch "${CONTAINERD_VERSION%% @*}" https://github.com/containerd/containerd.git /go/src/github.com/containerd/containerd
81
83
WORKDIR /go/src/github.com/containerd/containerd
82
84
RUN git-checkout-tag-with-hash.sh ${CONTAINERD_VERSION} && \
83
85
mkdir -p /out /out/$TARGETARCH && \
84
86
cp -a containerd.service /out
85
87
RUN GO=xx-go make STATIC=1 && \
86
88
cp -a bin/containerd bin/containerd-shim-runc-v2 bin/ctr /out/$TARGETARCH
87
89
88
- FROM build-base-debian AS build-runc
90
+ FROM build-base AS build-runc
89
91
ARG RUNC_VERSION
90
92
ARG TARGETARCH
91
- RUN git clone --quiet --depth 1 --branch "${RUNC_VERSION%@*}" https://github.com/opencontainers/runc.git /go/src/github.com/opencontainers/runc
93
+ RUN git clone --quiet --depth 1 --branch "${RUNC_VERSION%% @*}" https://github.com/opencontainers/runc.git /go/src/github.com/opencontainers/runc
92
94
WORKDIR /go/src/github.com/opencontainers/runc
93
95
RUN git-checkout-tag-with-hash.sh ${RUNC_VERSION} && \
94
96
mkdir -p /out
95
97
ENV CGO_ENABLED=1
96
98
RUN GO=xx-go CC=$(xx-info)-gcc STRIP=$(xx-info)-strip make static && \
97
99
xx-verify --static runc && cp -v -a runc /out/runc.${TARGETARCH}
98
100
99
- FROM build-base-debian AS build-bypass4netns
101
+ FROM build-base AS build-bypass4netns
100
102
ARG BYPASS4NETNS_VERSION
101
103
ARG TARGETARCH
102
- RUN git clone --quiet --depth 1 --branch "${BYPASS4NETNS_VERSION%@*}" https://github.com/rootless-containers/bypass4netns.git /go/src/github.com/rootless-containers/bypass4netns
104
+ RUN git clone --quiet --depth 1 --branch "${BYPASS4NETNS_VERSION%% @*}" https://github.com/rootless-containers/bypass4netns.git /go/src/github.com/rootless-containers/bypass4netns
103
105
WORKDIR /go/src/github.com/rootless-containers/bypass4netns
104
106
RUN git-checkout-tag-with-hash.sh ${BYPASS4NETNS_VERSION} && \
105
107
mkdir -p /out/${TARGETARCH}
106
108
ENV CGO_ENABLED=1
107
109
RUN GO=xx-go make static && \
108
110
xx-verify --static bypass4netns && cp -a bypass4netns bypass4netnsd /out/${TARGETARCH}
109
111
110
- FROM build-base-debian AS build-gomodjail
112
+ FROM build-base AS build-gomodjail
111
113
ARG GOMODJAIL_VERSION
112
114
ARG TARGETARCH
113
- RUN git clone --quiet --depth 1 --branch "${GOMODJAIL_VERSION%@*}" https://github.com/AkihiroSuda/gomodjail.git /go/src/github.com/AkihiroSuda/gomodjail
115
+ RUN git clone --quiet --depth 1 --branch "${GOMODJAIL_VERSION%% @*}" https://github.com/AkihiroSuda/gomodjail.git /go/src/github.com/AkihiroSuda/gomodjail
114
116
WORKDIR /go/src/github.com/AkihiroSuda/gomodjail
115
117
RUN git-checkout-tag-with-hash.sh ${GOMODJAIL_VERSION} && \
116
118
mkdir -p /out/${TARGETARCH}
117
119
RUN GO=xx-go make STATIC=1 && \
118
120
xx-verify --static _output/bin/gomodjail && cp -a _output/bin/gomodjail /out/${TARGETARCH}
119
121
120
- FROM build-base-debian AS build-kubo
122
+ FROM build-base AS build-kubo
121
123
ARG KUBO_VERSION
122
124
ARG TARGETARCH
123
- RUN git clone --quiet --depth 1 --branch "${KUBO_VERSION%@*}" https://github.com/ipfs/kubo.git /go/src/github.com/ipfs/kubo
125
+ RUN git clone --quiet --depth 1 --branch "${KUBO_VERSION%% @*}" https://github.com/ipfs/kubo.git /go/src/github.com/ipfs/kubo
124
126
WORKDIR /go/src/github.com/ipfs/kubo
125
127
RUN git-checkout-tag-with-hash.sh ${KUBO_VERSION} && \
126
128
mkdir -p /out/${TARGETARCH}
@@ -129,11 +131,6 @@ RUN xx-go --wrap && \
129
131
make build && \
130
132
xx-verify --static cmd/ipfs/ipfs && cp -a cmd/ipfs/ipfs /out/${TARGETARCH}
131
133
132
- FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS build-base
133
- RUN apk add --no-cache make git curl
134
- RUN git config --global advice.detachedHead false
135
- ADD hack/git-checkout-tag-with-hash.sh /usr/local/bin/
136
-
137
134
FROM build-base AS build-minimal
138
135
RUN BINDIR=/out/bin make binaries install
139
136
# We do not set CMD to `go test` here, because it requires systemd
@@ -148,12 +145,12 @@ RUN mkdir -p /out/share/doc/nerdctl-full && touch /out/share/doc/nerdctl-full/RE
148
145
ARG CONTAINERD_VERSION
149
146
COPY --from=build-containerd /out/${TARGETARCH:-amd64}/* /out/bin/
150
147
COPY --from=build-containerd /out/containerd.service /out/lib/systemd/system/containerd.service
151
- RUN echo "- containerd: ${CONTAINERD_VERSION/ @*}" >> /out/share/doc/nerdctl-full/README.md
148
+ RUN echo "- containerd: ${CONTAINERD_VERSION%% @*}" >> /out/share/doc/nerdctl-full/README.md
152
149
ARG RUNC_VERSION
153
150
COPY --from=build-runc /out/runc.${TARGETARCH:-amd64} /out/bin/runc
154
- RUN echo "- runc: ${RUNC_VERSION/ @*}" >> /out/share/doc/nerdctl-full/README.md
151
+ RUN echo "- runc: ${RUNC_VERSION%% @*}" >> /out/share/doc/nerdctl-full/README.md
155
152
ARG CNI_PLUGINS_VERSION
156
- RUN CNI_PLUGINS_VERSION=${CNI_PLUGINS_VERSION/@BINARY }; \
153
+ RUN CNI_PLUGINS_VERSION=${CNI_PLUGINS_VERSION%%@* }; \
157
154
fname="cni-plugins-${TARGETOS:-linux}-${TARGETARCH:-amd64}-${CNI_PLUGINS_VERSION}.tgz" && \
158
155
curl -o "${fname}" -fsSL --proto '=https' --tlsv1.2 "https://github.com/containernetworking/plugins/releases/download/${CNI_PLUGINS_VERSION}/${fname}" && \
159
156
grep "${fname}" "/SHA256SUMS.d/cni-plugins-${CNI_PLUGINS_VERSION}" | sha256sum -c && \
@@ -162,7 +159,7 @@ RUN CNI_PLUGINS_VERSION=${CNI_PLUGINS_VERSION/@BINARY}; \
162
159
rm -f "${fname}" && \
163
160
echo "- CNI plugins: ${CNI_PLUGINS_VERSION}" >> /out/share/doc/nerdctl-full/README.md
164
161
ARG BUILDKIT_VERSION
165
- RUN BUILDKIT_VERSION=${BUILDKIT_VERSION/@BINARY }; \
162
+ RUN BUILDKIT_VERSION=${BUILDKIT_VERSION%%@* }; \
166
163
fname="buildkit-${BUILDKIT_VERSION}.${TARGETOS:-linux}-${TARGETARCH:-amd64}.tar.gz" && \
167
164
curl -o "${fname}" -fsSL --proto '=https' --tlsv1.2 "https://github.com/moby/buildkit/releases/download/${BUILDKIT_VERSION}/${fname}" && \
168
165
grep "${fname}" "/SHA256SUMS.d/buildkit-${BUILDKIT_VERSION}" | sha256sum -c && \
@@ -177,7 +174,7 @@ RUN cd /out/lib/systemd/system && \
177
174
echo "" >> buildkit.service && \
178
175
echo "# This file was converted from containerd.service, with \` sed -E '${sedcomm}'\` " >> buildkit.service
179
176
ARG STARGZ_SNAPSHOTTER_VERSION
180
- RUN STARGZ_SNAPSHOTTER_VERSION=${STARGZ_SNAPSHOTTER_VERSION/@BINARY }; \
177
+ RUN STARGZ_SNAPSHOTTER_VERSION=${STARGZ_SNAPSHOTTER_VERSION%%@* }; \
181
178
fname="stargz-snapshotter-${STARGZ_SNAPSHOTTER_VERSION}-${TARGETOS:-linux}-${TARGETARCH:-amd64}.tar.gz" && \
182
179
curl -o "${fname}" -fsSL --proto '=https' --tlsv1.2 "https://github.com/containerd/stargz-snapshotter/releases/download/${STARGZ_SNAPSHOTTER_VERSION}/${fname}" && \
183
180
curl -o "stargz-snapshotter.service" -fsSL --proto '=https' --tlsv1.2 "https://raw.githubusercontent.com/containerd/stargz-snapshotter/${STARGZ_SNAPSHOTTER_VERSION}/script/config/etc/systemd/system/stargz-snapshotter.service" && \
@@ -188,13 +185,13 @@ RUN STARGZ_SNAPSHOTTER_VERSION=${STARGZ_SNAPSHOTTER_VERSION/@BINARY}; \
188
185
mv stargz-snapshotter.service /out/lib/systemd/system/stargz-snapshotter.service && \
189
186
echo "- Stargz Snapshotter: ${STARGZ_SNAPSHOTTER_VERSION}" >> /out/share/doc/nerdctl-full/README.md
190
187
ARG IMGCRYPT_VERSION
191
- RUN git clone --quiet --depth 1 --branch "${IMGCRYPT_VERSION%@*}" https://github.com/containerd/imgcrypt.git /go/src/github.com/containerd/imgcrypt && \
188
+ RUN git clone --quiet --depth 1 --branch "${IMGCRYPT_VERSION%% @*}" https://github.com/containerd/imgcrypt.git /go/src/github.com/containerd/imgcrypt && \
192
189
cd /go/src/github.com/containerd/imgcrypt && \
193
190
git-checkout-tag-with-hash.sh "${IMGCRYPT_VERSION}" && \
194
191
CGO_ENABLED=0 make && DESTDIR=/out make install && \
195
- echo "- imgcrypt: ${IMGCRYPT_VERSION/ @*}" >> /out/share/doc/nerdctl-full/README.md
192
+ echo "- imgcrypt: ${IMGCRYPT_VERSION%% @*}" >> /out/share/doc/nerdctl-full/README.md
196
193
ARG SLIRP4NETNS_VERSION
197
- RUN SLIRP4NETNS_VERSION=${SLIRP4NETNS_VERSION/@BINARY }; \
194
+ RUN SLIRP4NETNS_VERSION=${SLIRP4NETNS_VERSION%%@* }; \
198
195
fname="slirp4netns-$(cat /target_uname_m)" && \
199
196
curl -o "${fname}" -fsSL --proto '=https' --tlsv1.2 "https://github.com/rootless-containers/slirp4netns/releases/download/${SLIRP4NETNS_VERSION}/${fname}" && \
200
197
grep "${fname}" "/SHA256SUMS.d/slirp4netns-${SLIRP4NETNS_VERSION}" | sha256sum -c && \
@@ -203,40 +200,42 @@ RUN SLIRP4NETNS_VERSION=${SLIRP4NETNS_VERSION/@BINARY}; \
203
200
echo "- slirp4netns: ${SLIRP4NETNS_VERSION}" >> /out/share/doc/nerdctl-full/README.md
204
201
ARG BYPASS4NETNS_VERSION
205
202
COPY --from=build-bypass4netns /out/${TARGETARCH:-amd64}/* /out/bin/
206
- RUN echo "- bypass4netns: ${BYPASS4NETNS_VERSION/ @*}" >> /out/share/doc/nerdctl-full/README.md
203
+ RUN echo "- bypass4netns: ${BYPASS4NETNS_VERSION%% @*}" >> /out/share/doc/nerdctl-full/README.md
207
204
ARG FUSE_OVERLAYFS_VERSION
208
- RUN FUSE_OVERLAYFS_VERSION=${FUSE_OVERLAYFS_VERSION/@BINARY }; \
205
+ RUN FUSE_OVERLAYFS_VERSION=${FUSE_OVERLAYFS_VERSION%%@* }; \
209
206
fname="fuse-overlayfs-$(cat /target_uname_m)" && \
210
207
curl -o "${fname}" -fsSL --proto '=https' --tlsv1.2 "https://github.com/containers/fuse-overlayfs/releases/download/${FUSE_OVERLAYFS_VERSION}/${fname}" && \
211
208
grep "${fname}" "/SHA256SUMS.d/fuse-overlayfs-${FUSE_OVERLAYFS_VERSION}" | sha256sum -c && \
212
209
mv "${fname}" /out/bin/fuse-overlayfs && \
213
210
chmod +x /out/bin/fuse-overlayfs && \
214
211
echo "- fuse-overlayfs: ${FUSE_OVERLAYFS_VERSION}" >> /out/share/doc/nerdctl-full/README.md
215
212
ARG CONTAINERD_FUSE_OVERLAYFS_VERSION
216
- RUN CONTAINERD_FUSE_OVERLAYFS_VERSION=${CONTAINERD_FUSE_OVERLAYFS_VERSION/@BINARY }; \
217
- fname="containerd-fuse-overlayfs-${CONTAINERD_FUSE_OVERLAYFS_VERSION/ v}-${TARGETOS:-linux}-${TARGETARCH:-amd64}.tar.gz" && \
213
+ RUN CONTAINERD_FUSE_OVERLAYFS_VERSION=${CONTAINERD_FUSE_OVERLAYFS_VERSION%%@* }; \
214
+ fname="containerd-fuse-overlayfs-${CONTAINERD_FUSE_OVERLAYFS_VERSION##* v}-${TARGETOS:-linux}-${TARGETARCH:-amd64}.tar.gz" && \
218
215
curl -o "${fname}" -fsSL --proto '=https' --tlsv1.2 "https://github.com/containerd/fuse-overlayfs-snapshotter/releases/download/${CONTAINERD_FUSE_OVERLAYFS_VERSION}/${fname}" && \
219
216
grep "${fname}" "/SHA256SUMS.d/containerd-fuse-overlayfs-${CONTAINERD_FUSE_OVERLAYFS_VERSION}" | sha256sum -c && \
220
217
tar xzf "${fname}" -C /out/bin && \
221
218
rm -f "${fname}" && \
222
219
echo "- containerd-fuse-overlayfs: ${CONTAINERD_FUSE_OVERLAYFS_VERSION}" >> /out/share/doc/nerdctl-full/README.md
223
220
ARG TINI_VERSION
224
- RUN TINI_VERSION=${TINI_VERSION/@BINARY }; \
221
+ RUN TINI_VERSION=${TINI_VERSION%%@* }; \
225
222
fname="tini-static-${TARGETARCH:-amd64}" && \
226
223
curl -o "${fname}" -fsSL --proto '=https' --tlsv1.2 "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/${fname}" && \
227
224
grep "${fname}" "/SHA256SUMS.d/tini-${TINI_VERSION}" | sha256sum -c && \
228
225
cp -a "${fname}" /out/bin/tini && chmod +x /out/bin/tini && \
229
226
echo "- Tini: ${TINI_VERSION}" >> /out/share/doc/nerdctl-full/README.md
230
227
ARG BUILDG_VERSION
231
- RUN BUILDG_VERSION=${BUILDG_VERSION/@BINARY}; \
228
+ # FIXME: this is a mildly-confusing approach. Buildkit will perform some "smart" replacement at build time and output
229
+ # confusing debugging information, eg: BUILDG_VERSION will appear as if the original ARG value was used.
230
+ RUN BUILDG_VERSION=${BUILDG_VERSION%%@*}; \
232
231
fname="buildg-${BUILDG_VERSION}-${TARGETOS:-linux}-${TARGETARCH:-amd64}.tar.gz" && \
233
232
curl -o "${fname}" -fsSL --proto '=https' --tlsv1.2 "https://github.com/ktock/buildg/releases/download/${BUILDG_VERSION}/${fname}" && \
234
233
grep "${fname}" "/SHA256SUMS.d/buildg-${BUILDG_VERSION}" | sha256sum -c && \
235
234
tar xzf "${fname}" -C /out/bin && \
236
235
rm -f "${fname}" && \
237
236
echo "- buildg: ${BUILDG_VERSION}" >> /out/share/doc/nerdctl-full/README.md
238
237
ARG ROOTLESSKIT_VERSION
239
- RUN ROOTLESSKIT_VERSION=${ROOTLESSKIT_VERSION/@BINARY }; \
238
+ RUN ROOTLESSKIT_VERSION=${ROOTLESSKIT_VERSION%%@* }; \
240
239
fname="rootlesskit-$(cat /target_uname_m).tar.gz" && \
241
240
curl -o "${fname}" -fsSL --proto '=https' --tlsv1.2 "https://github.com/rootless-containers/rootlesskit/releases/download/${ROOTLESSKIT_VERSION}/${fname}" && \
242
241
grep "${fname}" "/SHA256SUMS.d/rootlesskit-${ROOTLESSKIT_VERSION}" | sha256sum -c && \
@@ -249,10 +248,10 @@ RUN echo "- gomodjail: ${GOMODJAIL_VERSION}" >> /out/share/doc/nerdctl-full/READ
249
248
250
249
RUN echo "" >> /out/share/doc/nerdctl-full/README.md && \
251
250
echo "## License" >> /out/share/doc/nerdctl-full/README.md && \
252
- echo "- bin/slirp4netns: [GNU GENERAL PUBLIC LICENSE, Version 2](https://github.com/rootless-containers/slirp4netns/blob/${SLIRP4NETNS_VERSION/ @*}/COPYING)" >> /out/share/doc/nerdctl-full/README.md && \
253
- echo "- bin/fuse-overlayfs: [GNU GENERAL PUBLIC LICENSE, Version 2](https://github.com/containers/fuse-overlayfs/blob/${FUSE_OVERLAYFS_VERSION/ @*}/COPYING)" >> /out/share/doc/nerdctl-full/README.md && \
251
+ echo "- bin/slirp4netns: [GNU GENERAL PUBLIC LICENSE, Version 2](https://github.com/rootless-containers/slirp4netns/blob/${SLIRP4NETNS_VERSION%% @*}/COPYING)" >> /out/share/doc/nerdctl-full/README.md && \
252
+ echo "- bin/fuse-overlayfs: [GNU GENERAL PUBLIC LICENSE, Version 2](https://github.com/containers/fuse-overlayfs/blob/${FUSE_OVERLAYFS_VERSION%% @*}/COPYING)" >> /out/share/doc/nerdctl-full/README.md && \
254
253
echo "- bin/{runc,bypass4netns,bypass4netnsd}: Apache License 2.0, statically linked with libseccomp ([LGPL 2.1](https://github.com/seccomp/libseccomp/blob/main/LICENSE), source code available at https://github.com/seccomp/libseccomp/)" >> /out/share/doc/nerdctl-full/README.md && \
255
- echo "- bin/tini: [MIT License](https://github.com/krallin/tini/blob/${TINI_VERSION/ @*}/LICENSE)" >> /out/share/doc/nerdctl-full/README.md && \
254
+ echo "- bin/tini: [MIT License](https://github.com/krallin/tini/blob/${TINI_VERSION%% @*}/LICENSE)" >> /out/share/doc/nerdctl-full/README.md && \
256
255
echo "- Other files: [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0)" >> /out/share/doc/nerdctl-full/README.md
257
256
258
257
FROM build-dependencies AS build-full
@@ -310,7 +309,7 @@ RUN apt-get update -qq && apt-get install -qq --no-install-recommends \
310
309
git \
311
310
make
312
311
# We wouldn't need this if Docker Hub could have "golang:${GO_VERSION}-ubuntu"
313
- COPY --from=build-base-debian /usr/local/go /usr/local/go
312
+ COPY --from=build-base /usr/local/go /usr/local/go
314
313
ARG TARGETARCH
315
314
ENV PATH=/usr/local/go/bin:$PATH
316
315
ARG GOTESTSUM_VERSION
0 commit comments