1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

project: unify way of installing runc and containerd

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
This commit is contained in:
Alexander Morozov 2016-10-19 11:49:10 -07:00
parent 9f30c28d21
commit 179479c6cd
5 changed files with 46 additions and 52 deletions

View file

@ -9,6 +9,28 @@ GRIMES_COMMIT=15ecf9414859b16a8a19ac6748a622a5498d57e3
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)

View file

@ -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:

View file

@ -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

View file

@ -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

View file

@ -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