@@ -17,6 +17,16 @@ ARG RUNC_VERSION=v1.0.0-rc93
17
17
ARG CNI_PLUGINS_VERSION=v0.9.1
18
18
ARG NERDCTL_VERSION=0.7.3
19
19
20
+ ARG PODMAN_VERSION=2314af70bdacf75135a11b48b87dba8e461a43ea
21
+ ARG CRIO_VERSION=v1.20.2
22
+ ARG CONMON_VERSION=v2.0.26
23
+
24
+ # TODO: switch them to the official repo after patches are merged
25
+ ARG CONTAINERS_IMAGE_REPO=https://github.com/ktock/image
26
+ ARG CONTAINERS_IMAGE_VERSION=341204f1ea4c71be8ab802bac539d21e6bd3f869
27
+
28
+ ARG CRIO_TEST_PAUSE_IMAGE_NAME=k8s.gcr.io/pause:3.5
29
+
20
30
# Legacy builder that doesn't support TARGETARCH should set this explicitly using --build-arg.
21
31
# If TARGETARCH isn't supported by the builder, the default value is "amd64".
22
32
@@ -65,6 +75,57 @@ RUN cd $GOPATH/src/github.com/containerd/stargz-snapshotter && \
65
75
PREFIX=/out/ GOARCH=${TARGETARCH:-amd64} GO_BUILD_FLAGS=${SNAPSHOTTER_BUILD_FLAGS} make containerd-stargz-grpc && \
66
76
PREFIX=/out/ GOARCH=${TARGETARCH:-amd64} GO_BUILD_FLAGS=${CTR_REMOTE_BUILD_FLAGS} make ctr-remote
67
77
78
+ # Build stargz store
79
+ FROM golang-base AS stargz-store-dev
80
+ ARG TARGETARCH
81
+ ARG GOARM
82
+ ARG SNAPSHOTTER_BUILD_FLAGS
83
+ ARG CTR_REMOTE_BUILD_FLAGS
84
+ COPY . $GOPATH/src/github.com/containerd/stargz-snapshotter
85
+ RUN cd $GOPATH/src/github.com/containerd/stargz-snapshotter && \
86
+ PREFIX=/out/ GOARCH=${TARGETARCH:-amd64} GO_BUILD_FLAGS=${SNAPSHOTTER_BUILD_FLAGS} make stargz-store
87
+
88
+ # Build podman
89
+ FROM golang-base AS podman-dev
90
+ ARG PODMAN_VERSION
91
+ ARG CONTAINERS_IMAGE_REPO
92
+ ARG CONTAINERS_IMAGE_VERSION
93
+ RUN apt-get update -y && apt-get install -y libseccomp-dev libgpgme-dev && \
94
+ git clone ${CONTAINERS_IMAGE_REPO} $GOPATH/src/github.com/containers/image && \
95
+ cd $GOPATH/src/github.com/containers/image && \
96
+ git checkout ${CONTAINERS_IMAGE_VERSION} && \
97
+ git clone https://github.com/containers/podman $GOPATH/src/github.com/containers/podman && \
98
+ cd $GOPATH/src/github.com/containers/podman && \
99
+ git checkout ${PODMAN_VERSION} && \
100
+ sed -i "s/-mod=vendor//g" $GOPATH/src/github.com/containers/podman/Makefile && \
101
+ echo "replace github.com/containers/image/v5 => /go/src/github.com/containers/image" >> $GOPATH/src/github.com/containers/podman/go.mod && \
102
+ make && make install PREFIX=/out/
103
+
104
+ # Build CRI-O
105
+ FROM golang-base AS cri-o-dev
106
+ ARG CRIO_VERSION
107
+ ARG CONTAINERS_IMAGE_REPO
108
+ ARG CONTAINERS_IMAGE_VERSION
109
+ RUN apt-get update -y && apt-get install -y libseccomp-dev libgpgme-dev && \
110
+ git clone ${CONTAINERS_IMAGE_REPO} $GOPATH/src/github.com/containers/image && \
111
+ cd $GOPATH/src/github.com/containers/image && \
112
+ git checkout ${CONTAINERS_IMAGE_VERSION} && \
113
+ git clone https://github.com/cri-o/cri-o $GOPATH/src/github.com/cri-o/cri-o && \
114
+ cd $GOPATH/src/github.com/cri-o/cri-o && \
115
+ git checkout ${CRIO_VERSION} && \
116
+ echo "replace github.com/containers/image/v5 => /go/src/github.com/containers/image" >> $GOPATH/src/github.com/cri-o/cri-o/go.mod && \
117
+ go mod vendor && \
118
+ make && make install PREFIX=/out/
119
+
120
+ # Build conmon
121
+ FROM golang-base AS conmon-dev
122
+ ARG CONMON_VERSION
123
+ RUN apt-get update -y && apt-get install -y gcc git libc6-dev libglib2.0-dev pkg-config make && \
124
+ git clone -b ${CONMON_VERSION} --depth 1 \
125
+ https://github.com/containers/conmon $GOPATH/src/github.com/containers/conmon && \
126
+ cd $GOPATH/src/github.com/containers/conmon && \
127
+ mkdir /out/ && make && make install PREFIX=/out/
128
+
68
129
# Binaries for release
69
130
FROM scratch AS release-binaries
70
131
COPY --from=snapshotter-dev /out/* /
@@ -98,6 +159,36 @@ COPY --from=runc-dev /out/sbin/* /usr/local/sbin/
98
159
COPY --from=snapshotter-dev /out/ctr-remote /usr/local/bin/
99
160
RUN ln -s /usr/local/bin/ctr-remote /usr/local/bin/ctr
100
161
162
+ # Base image which contains podman with stargz-store
163
+ FROM golang-base AS podman-base
164
+ ARG TARGETARCH
165
+ ARG CNI_PLUGINS_VERSION
166
+ ARG PODMAN_VERSION
167
+ RUN apt-get update -y && apt-get --no-install-recommends install -y fuse libgpgme-dev \
168
+ iptables libyajl-dev && \
169
+ # Make CNI plugins manipulate iptables instead of nftables
170
+ # as this test runs in a Docker container that network is configured with iptables.
171
+ # c.f. https://github.com/moby/moby/issues/26824
172
+ update-alternatives --set iptables /usr/sbin/iptables-legacy && \
173
+ mkdir -p /etc/containers /etc/cni/net.d /opt/cni/bin && \
174
+ curl -qsSL https://raw.githubusercontent.com/containers/podman/${PODMAN_VERSION}/cni/87-podman-bridge.conflist | tee /etc/cni/net.d/87-podman-bridge.conflist && \
175
+ curl -Ls https://github.com/containernetworking/plugins/releases/download/${CNI_PLUGINS_VERSION}/cni-plugins-linux-${TARGETARCH:-amd64}-${CNI_PLUGINS_VERSION}.tgz | tar xzv -C /opt/cni/bin
176
+
177
+ COPY --from=podman-dev /out/bin/* /usr/local/bin/
178
+ COPY --from=runc-dev /out/sbin/* /usr/local/sbin/
179
+ COPY --from=conmon-dev /out/bin/* /usr/local/bin/
180
+ COPY --from=stargz-store-dev /out/* /usr/local/bin/
181
+
182
+ # Image which can be used as all-in-one single node demo environment
183
+ FROM snapshotter-base AS cind
184
+ COPY ./script/config/ /
185
+ COPY ./script/cind/ /
186
+ VOLUME /var/lib/containerd
187
+ VOLUME /var/lib/containerd-stargz-grpc
188
+ VOLUME /run/containerd-stargz-grpc
189
+ ENV CONTAINERD_SNAPSHOTTER=stargz
190
+ ENTRYPOINT [ "/entrypoint.sh" ]
191
+
101
192
# Image which can be used for interactive demo environment
102
193
FROM containerd-base AS demo
103
194
ARG CNI_PLUGINS_VERSION
@@ -118,6 +209,32 @@ COPY ./script/config/ /
118
209
RUN apt-get update -y && apt-get install --no-install-recommends -y fuse
119
210
ENTRYPOINT [ "/usr/local/bin/entrypoint" , "/sbin/init" ]
120
211
212
+ # Image for testing CRI-O with Stargz Store.
213
+ # NOTE: This cannot be used for the node image of KinD.
214
+ FROM ubuntu:20.04 AS crio-stargz-store
215
+ ARG CRIO_VERSION
216
+ ARG CNI_PLUGINS_VERSION
217
+ ARG CRIO_TEST_PAUSE_IMAGE_NAME
218
+ RUN apt-get update -y && apt-get install --no-install-recommends -y \
219
+ ca-certificates fuse libgpgme-dev libglib2.0-dev curl \
220
+ iptables conntrack && \
221
+ DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y tzdata && \
222
+ # Make CNI plugins manipulate iptables instead of nftables
223
+ # as this test runs in a Docker container that network is configured with iptables.
224
+ # c.f. https://github.com/moby/moby/issues/26824
225
+ update-alternatives --set iptables /usr/sbin/iptables-legacy && \
226
+ mkdir -p /opt/cni/bin && \
227
+ curl -sSL https://github.com/containernetworking/plugins/releases/download/${CNI_PLUGINS_VERSION}/cni-plugins-linux-${TARGETARCH:-amd64}-${CNI_PLUGINS_VERSION}.tgz | tar xzv -C /opt/cni/bin && \
228
+ echo ${CRIO_TEST_PAUSE_IMAGE_NAME} > /pause_name
229
+
230
+ COPY --from=stargz-store-dev /out/* /usr/local/bin/
231
+ COPY --from=cri-o-dev /out/bin/* /usr/local/bin/
232
+ COPY --from=runc-dev /out/sbin/* /usr/local/sbin/
233
+ COPY --from=conmon-dev /out/bin/* /usr/local/bin/
234
+ COPY ./script/cri-o/config/ /
235
+
236
+ ENTRYPOINT [ "/usr/local/bin/entrypoint" , "/bin/bash" ]
237
+
121
238
# Image which can be used as a node image for KinD
122
239
FROM kindest/node:v1.20.0
123
240
COPY --from=containerd-dev /out/bin/containerd /out/bin/containerd-shim-runc-v2 /usr/local/bin/
0 commit comments