Merge pull request #27556 from LK4D4/unify_install
project: unify way of installing runc and containerd
This commit is contained in:
commit
ffa0446e8b
5 changed files with 46 additions and 52 deletions
|
@ -9,6 +9,28 @@ GRIMES_COMMIT=74341e923bdf06cfb6b70cf54089c4d3ac87ec2d
|
|||
|
||||
export GOPATH="$(mktemp -d)"
|
||||
|
||||
RUNC_BUILDTAGS="${RUNC_BUILDTAGS:-"seccomp apparmor selinux"}"
|
||||
|
||||
install_runc() {
|
||||
echo "Install runc version $RUNC_COMMIT"
|
||||
git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc"
|
||||
cd "$GOPATH/src/github.com/opencontainers/runc"
|
||||
git checkout -q "$RUNC_COMMIT"
|
||||
make BUILDTAGS="$RUNC_BUILDTAGS" $1
|
||||
cp runc /usr/local/bin/docker-runc
|
||||
}
|
||||
|
||||
install_containerd() {
|
||||
echo "Install containerd version $CONTAINERD_COMMIT"
|
||||
git clone https://github.com/docker/containerd.git "$GOPATH/src/github.com/docker/containerd"
|
||||
cd "$GOPATH/src/github.com/docker/containerd"
|
||||
git checkout -q "$CONTAINERD_COMMIT"
|
||||
make $1
|
||||
cp bin/containerd /usr/local/bin/docker-containerd
|
||||
cp bin/containerd-shim /usr/local/bin/docker-containerd-shim
|
||||
cp bin/ctr /usr/local/bin/docker-containerd-ctr
|
||||
}
|
||||
|
||||
for prog in "$@"
|
||||
do
|
||||
case $prog in
|
||||
|
@ -20,23 +42,19 @@ do
|
|||
;;
|
||||
|
||||
runc)
|
||||
echo "Install runc version $RUNC_COMMIT"
|
||||
git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc"
|
||||
cd "$GOPATH/src/github.com/opencontainers/runc"
|
||||
git checkout -q "$RUNC_COMMIT"
|
||||
make static BUILDTAGS="seccomp apparmor selinux"
|
||||
cp runc /usr/local/bin/docker-runc
|
||||
install_runc static
|
||||
;;
|
||||
|
||||
runc-dynamic)
|
||||
install_runc
|
||||
;;
|
||||
|
||||
containerd)
|
||||
echo "Install containerd version $CONTAINERD_COMMIT"
|
||||
git clone https://github.com/docker/containerd.git "$GOPATH/src/github.com/docker/containerd"
|
||||
cd "$GOPATH/src/github.com/docker/containerd"
|
||||
git checkout -q "$CONTAINERD_COMMIT"
|
||||
make static
|
||||
cp bin/containerd /usr/local/bin/docker-containerd
|
||||
cp bin/containerd-shim /usr/local/bin/docker-containerd-shim
|
||||
cp bin/ctr /usr/local/bin/docker-containerd-ctr
|
||||
install_containerd static
|
||||
;;
|
||||
|
||||
containerd-dynamic)
|
||||
install_containerd
|
||||
;;
|
||||
|
||||
grimes)
|
||||
|
|
|
@ -25,10 +25,10 @@ override_dh_auto_install:
|
|||
cp -aT "$$(readlink -f bundles/$(VERSION)/dynbinary-client/docker)" debian/docker-engine/usr/bin/docker
|
||||
cp -aT "$$(readlink -f bundles/$(VERSION)/dynbinary-daemon/dockerd)" debian/docker-engine/usr/bin/dockerd
|
||||
cp -aT "$$(readlink -f bundles/$(VERSION)/dynbinary-daemon/docker-proxy)" debian/docker-engine/usr/bin/docker-proxy
|
||||
cp -aT /usr/local/bin/containerd debian/docker-engine/usr/bin/docker-containerd
|
||||
cp -aT /usr/local/bin/containerd-shim debian/docker-engine/usr/bin/docker-containerd-shim
|
||||
cp -aT /usr/local/bin/ctr debian/docker-engine/usr/bin/docker-containerd-ctr
|
||||
cp -aT /usr/local/sbin/runc debian/docker-engine/usr/bin/docker-runc
|
||||
cp -aT /usr/local/bin/docker-containerd debian/docker-engine/usr/bin/docker-containerd
|
||||
cp -aT /usr/local/bin/docker-containerd-shim debian/docker-engine/usr/bin/docker-containerd-shim
|
||||
cp -aT /usr/local/bin/docker-containerd-ctr debian/docker-engine/usr/bin/docker-containerd-ctr
|
||||
cp -aT /usr/local/bin/docker-runc debian/docker-engine/usr/bin/docker-runc
|
||||
mkdir -p debian/docker-engine/usr/lib/docker
|
||||
|
||||
override_dh_installinit:
|
||||
|
|
|
@ -129,12 +129,12 @@ install -p -m 755 bundles/%{_origversion}/dynbinary-daemon/dockerd-%{_origversio
|
|||
install -p -m 755 bundles/%{_origversion}/dynbinary-daemon/docker-proxy-%{_origversion} $RPM_BUILD_ROOT/%{_bindir}/docker-proxy
|
||||
|
||||
# install containerd
|
||||
install -p -m 755 /usr/local/bin/containerd $RPM_BUILD_ROOT/%{_bindir}/docker-containerd
|
||||
install -p -m 755 /usr/local/bin/containerd-shim $RPM_BUILD_ROOT/%{_bindir}/docker-containerd-shim
|
||||
install -p -m 755 /usr/local/bin/ctr $RPM_BUILD_ROOT/%{_bindir}/docker-containerd-ctr
|
||||
install -p -m 755 /usr/local/bin/docker-containerd $RPM_BUILD_ROOT/%{_bindir}/docker-containerd
|
||||
install -p -m 755 /usr/local/bin/docker-containerd-shim $RPM_BUILD_ROOT/%{_bindir}/docker-containerd-shim
|
||||
install -p -m 755 /usr/local/bin/docker-containerd-ctr $RPM_BUILD_ROOT/%{_bindir}/docker-containerd-ctr
|
||||
|
||||
# install runc
|
||||
install -p -m 755 /usr/local/sbin/runc $RPM_BUILD_ROOT/%{_bindir}/docker-runc
|
||||
install -p -m 755 /usr/local/bin/docker-runc $RPM_BUILD_ROOT/%{_bindir}/docker-runc
|
||||
|
||||
# install udev rules
|
||||
install -d $RPM_BUILD_ROOT/%{_sysconfdir}/udev/rules.d
|
||||
|
|
|
@ -72,23 +72,11 @@ set -e
|
|||
&& ln -snf /usr/src/docker /go/src/github.com/docker/docker
|
||||
EOF
|
||||
|
||||
echo "ENV RUNC_COMMIT $(grep "^RUNC_COMMIT" hack/dockerfile/install-binaries.sh | cut -d"=" -f 2)" >> "$DEST/$version/Dockerfile.build"
|
||||
echo "ENV CONTAINERD_COMMIT $(grep "^CONTAINERD_COMMIT" hack/dockerfile/install-binaries.sh | cut -d"=" -f 2)" >> "$DEST/$version/Dockerfile.build"
|
||||
|
||||
# add runc and containerd compile and install
|
||||
cat >> "$DEST/$version/Dockerfile.build" <<-EOF
|
||||
# Install runc
|
||||
RUN git clone https://github.com/opencontainers/runc.git "/go/src/github.com/opencontainers/runc" \
|
||||
&& cd "/go/src/github.com/opencontainers/runc" \
|
||||
&& git checkout -q "\$RUNC_COMMIT"
|
||||
RUN set -x && export GOPATH="/go" && cd "/go/src/github.com/opencontainers/runc" \
|
||||
&& make BUILDTAGS="\$RUNC_BUILDTAGS" && make install
|
||||
# Install containerd
|
||||
RUN git clone https://github.com/docker/containerd.git "/go/src/github.com/docker/containerd" \
|
||||
&& cd "/go/src/github.com/docker/containerd" \
|
||||
&& git checkout -q "\$CONTAINERD_COMMIT"
|
||||
RUN set -x && export GOPATH="/go" && cd "/go/src/github.com/docker/containerd" && make && make install
|
||||
# Install runc and containerd
|
||||
RUN ./hack/dockerfile/install-binaries.sh runc-dynamic containerd-dynamic
|
||||
EOF
|
||||
|
||||
if [ "$DOCKER_EXPERIMENTAL" ]; then
|
||||
echo 'ENV DOCKER_EXPERIMENTAL 1' >> "$DEST/$version/Dockerfile.build"
|
||||
fi
|
||||
|
|
|
@ -92,23 +92,11 @@ set -e
|
|||
RUN mkdir -p /go/src/github.com/docker && mkdir -p /go/src/github.com/opencontainers
|
||||
EOF
|
||||
|
||||
echo "ENV RUNC_COMMIT $(grep "^RUNC_COMMIT" hack/dockerfile/install-binaries.sh | cut -d"=" -f 2)" >> "$DEST/$version/Dockerfile.build"
|
||||
echo "ENV CONTAINERD_COMMIT $(grep "^CONTAINERD_COMMIT" hack/dockerfile/install-binaries.sh | cut -d"=" -f 2)" >> "$DEST/$version/Dockerfile.build"
|
||||
|
||||
# add runc and containerd compile and install
|
||||
cat >> "$DEST/$version/Dockerfile.build" <<-EOF
|
||||
# Install runc
|
||||
RUN git clone https://github.com/opencontainers/runc.git "/go/src/github.com/opencontainers/runc" \
|
||||
&& cd "/go/src/github.com/opencontainers/runc" \
|
||||
&& git checkout -q "\$RUNC_COMMIT"
|
||||
RUN set -x && export GOPATH="/go" && cd "/go/src/github.com/opencontainers/runc" \
|
||||
&& make BUILDTAGS="\$RUNC_BUILDTAGS" && make install
|
||||
# Install containerd
|
||||
RUN git clone https://github.com/docker/containerd.git "/go/src/github.com/docker/containerd" \
|
||||
&& cd "/go/src/github.com/docker/containerd" \
|
||||
&& git checkout -q "\$CONTAINERD_COMMIT"
|
||||
RUN set -x && export GOPATH="/go" && cd "/go/src/github.com/docker/containerd" && make && make install
|
||||
# Install runc and containerd
|
||||
RUN ./hack/dockerfile/install-binaries.sh runc-dynamic containerd-dynamic
|
||||
EOF
|
||||
|
||||
if [ "$DOCKER_EXPERIMENTAL" ]; then
|
||||
echo 'ENV DOCKER_EXPERIMENTAL 1' >> "$DEST/$version/Dockerfile.build"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue