@@ -17,6 +17,12 @@ 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=7a7df87127ede57c26d666de9e926d6200637f95
22
+ ARG CONMON_VERSION=v2.0.26
23
+ ARG COMMON_VERSION=v0.37.1
24
+ ARG CRIO_TEST_PAUSE_IMAGE_NAME=k8s.gcr.io/pause:3.5
25
+
20
26
# Legacy builder that doesn't support TARGETARCH should set this explicitly using --build-arg.
21
27
# If TARGETARCH isn't supported by the builder, the default value is "amd64".
22
28
@@ -65,6 +71,50 @@ RUN cd $GOPATH/src/github.com/containerd/stargz-snapshotter && \
65
71
PREFIX=/out/ GOARCH=${TARGETARCH:-amd64} GO_BUILD_FLAGS=${SNAPSHOTTER_BUILD_FLAGS} make containerd-stargz-grpc && \
66
72
PREFIX=/out/ GOARCH=${TARGETARCH:-amd64} GO_BUILD_FLAGS=${CTR_REMOTE_BUILD_FLAGS} make ctr-remote
67
73
74
+ # Build stargz store
75
+ FROM golang-base AS stargz-store-dev
76
+ ARG TARGETARCH
77
+ ARG GOARM
78
+ ARG SNAPSHOTTER_BUILD_FLAGS
79
+ ARG CTR_REMOTE_BUILD_FLAGS
80
+ COPY . $GOPATH/src/github.com/containerd/stargz-snapshotter
81
+ RUN cd $GOPATH/src/github.com/containerd/stargz-snapshotter && \
82
+ PREFIX=/out/ GOARCH=${TARGETARCH:-amd64} GO_BUILD_FLAGS=${SNAPSHOTTER_BUILD_FLAGS} make stargz-store
83
+
84
+ # Build podman
85
+ FROM golang-base AS podman-dev
86
+ ARG PODMAN_VERSION
87
+ RUN apt-get update -y && apt-get install -y libseccomp-dev libgpgme-dev && \
88
+ git clone https://github.com/containers/podman $GOPATH/src/github.com/containers/podman && \
89
+ cd $GOPATH/src/github.com/containers/podman && \
90
+ git checkout ${PODMAN_VERSION} && \
91
+ make && make install PREFIX=/out/
92
+
93
+ # Build CRI-O
94
+ FROM golang-base AS cri-o-dev
95
+ ARG CRIO_VERSION
96
+ RUN apt-get update -y && apt-get install -y libseccomp-dev libgpgme-dev && \
97
+ git clone https://github.com/cri-o/cri-o $GOPATH/src/github.com/cri-o/cri-o && \
98
+ cd $GOPATH/src/github.com/cri-o/cri-o && \
99
+ git checkout ${CRIO_VERSION} && \
100
+ make && make install PREFIX=/out/
101
+
102
+ # Build conmon
103
+ FROM golang-base AS conmon-dev
104
+ ARG CONMON_VERSION
105
+ RUN apt-get update -y && apt-get install -y gcc git libc6-dev libglib2.0-dev pkg-config make && \
106
+ git clone -b ${CONMON_VERSION} --depth 1 \
107
+ https://github.com/containers/conmon $GOPATH/src/github.com/containers/conmon && \
108
+ cd $GOPATH/src/github.com/containers/conmon && \
109
+ mkdir /out/ && make && make install PREFIX=/out/
110
+
111
+ # Get seccomp.json for Podman/CRI-O
112
+ FROM golang-base AS containers-common-dev
113
+ ARG COMMON_VERSION
114
+ RUN git clone https://github.com/containers/common $GOPATH/src/github.com/containers/common && \
115
+ cd $GOPATH/src/github.com/containers/common && \
116
+ git checkout ${COMMON_VERSION} && mkdir /out/ && cp pkg/seccomp/seccomp.json /out/
117
+
68
118
# Binaries for release
69
119
FROM scratch AS release-binaries
70
120
COPY --from=snapshotter-dev /out/* /
@@ -98,6 +148,37 @@ COPY --from=runc-dev /out/sbin/* /usr/local/sbin/
98
148
COPY --from=snapshotter-dev /out/ctr-remote /usr/local/bin/
99
149
RUN ln -s /usr/local/bin/ctr-remote /usr/local/bin/ctr
100
150
151
+ # Base image which contains podman with stargz-store
152
+ FROM golang-base AS podman-base
153
+ ARG TARGETARCH
154
+ ARG CNI_PLUGINS_VERSION
155
+ ARG PODMAN_VERSION
156
+ RUN apt-get update -y && apt-get --no-install-recommends install -y fuse libgpgme-dev \
157
+ iptables libyajl-dev && \
158
+ # Make CNI plugins manipulate iptables instead of nftables
159
+ # as this test runs in a Docker container that network is configured with iptables.
160
+ # c.f. https://github.com/moby/moby/issues/26824
161
+ update-alternatives --set iptables /usr/sbin/iptables-legacy && \
162
+ mkdir -p /etc/containers /etc/cni/net.d /opt/cni/bin && \
163
+ curl -qsSL https://raw.githubusercontent.com/containers/podman/${PODMAN_VERSION}/cni/87-podman-bridge.conflist | tee /etc/cni/net.d/87-podman-bridge.conflist && \
164
+ 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
165
+
166
+ COPY --from=podman-dev /out/bin/* /usr/local/bin/
167
+ COPY --from=runc-dev /out/sbin/* /usr/local/sbin/
168
+ COPY --from=conmon-dev /out/bin/* /usr/local/bin/
169
+ COPY --from=containers-common-dev /out/seccomp.json /usr/share/containers/
170
+ COPY --from=stargz-store-dev /out/* /usr/local/bin/
171
+
172
+ # Image which can be used as all-in-one single node demo environment
173
+ FROM snapshotter-base AS cind
174
+ COPY ./script/config/ /
175
+ COPY ./script/cind/ /
176
+ VOLUME /var/lib/containerd
177
+ VOLUME /var/lib/containerd-stargz-grpc
178
+ VOLUME /run/containerd-stargz-grpc
179
+ ENV CONTAINERD_SNAPSHOTTER=stargz
180
+ ENTRYPOINT [ "/entrypoint.sh" ]
181
+
101
182
# Image which can be used for interactive demo environment
102
183
FROM containerd-base AS demo
103
184
ARG CNI_PLUGINS_VERSION
@@ -118,6 +199,33 @@ COPY ./script/config/ /
118
199
RUN apt-get update -y && apt-get install --no-install-recommends -y fuse
119
200
ENTRYPOINT [ "/usr/local/bin/entrypoint" , "/sbin/init" ]
120
201
202
+ # Image for testing CRI-O with Stargz Store.
203
+ # NOTE: This cannot be used for the node image of KinD.
204
+ FROM ubuntu:20.04 AS crio-stargz-store
205
+ ARG CRIO_VERSION
206
+ ARG CNI_PLUGINS_VERSION
207
+ ARG CRIO_TEST_PAUSE_IMAGE_NAME
208
+ RUN apt-get update -y && apt-get install --no-install-recommends -y \
209
+ ca-certificates fuse libgpgme-dev libglib2.0-dev curl \
210
+ iptables conntrack && \
211
+ DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y tzdata && \
212
+ # Make CNI plugins manipulate iptables instead of nftables
213
+ # as this test runs in a Docker container that network is configured with iptables.
214
+ # c.f. https://github.com/moby/moby/issues/26824
215
+ update-alternatives --set iptables /usr/sbin/iptables-legacy && \
216
+ mkdir -p /opt/cni/bin && \
217
+ 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 && \
218
+ echo ${CRIO_TEST_PAUSE_IMAGE_NAME} > /pause_name
219
+
220
+ COPY --from=stargz-store-dev /out/* /usr/local/bin/
221
+ COPY --from=cri-o-dev /out/bin/* /usr/local/bin/
222
+ COPY --from=runc-dev /out/sbin/* /usr/local/sbin/
223
+ COPY --from=conmon-dev /out/bin/* /usr/local/bin/
224
+ COPY --from=containers-common-dev /out/seccomp.json /usr/share/containers/
225
+ COPY ./script/cri-o/config/ /
226
+
227
+ ENTRYPOINT [ "/usr/local/bin/entrypoint" , "/bin/bash" ]
228
+
121
229
# Image which can be used as a node image for KinD
122
230
FROM kindest/node:v1.20.0
123
231
COPY --from=containerd-dev /out/bin/containerd /out/bin/containerd-shim-runc-v2 /usr/local/bin/
0 commit comments