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