From 0e94f04506cf5efcf95e87ae23146dba9c5897bb Mon Sep 17 00:00:00 2001 From: Felix Abecassis Date: Thu, 16 Nov 2017 16:20:48 -0800 Subject: [PATCH] Add support for Debian Stretch --- Dockerfile.stretch | 73 +++++++++++++++++++++++++++++++++++++++++++++ Makefile | 25 +++++++++++++++- config.toml.stretch | 8 +++++ 3 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 Dockerfile.stretch create mode 100644 config.toml.stretch diff --git a/Dockerfile.stretch b/Dockerfile.stretch new file mode 100644 index 0000000..8159e4a --- /dev/null +++ b/Dockerfile.stretch @@ -0,0 +1,73 @@ +FROM debian:stretch + +# runc dependencies +RUN apt-get update && apt-get install -y \ + wget \ + git \ + make \ + pkg-config \ + gcc \ + libseccomp-dev \ + libapparmor-dev \ + libselinux1-dev && \ + rm -rf /var/lib/apt/lists/* + +ENV GOLANG_VERSION 1.9.2 +RUN wget -O - https://storage.googleapis.com/golang/go${GOLANG_VERSION}.linux-amd64.tar.gz \ + | tar -v -C /usr/local -xz +ENV GOPATH /go +ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH + +RUN go get github.com/LK4D4/vndr + +# packaging dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + dh-make \ + fakeroot \ + devscripts && \ + rm -rf /var/lib/apt/lists/* + +# packaging +ARG PKG_VERS +ARG PKG_REV +ARG PKG_ARCH + +ENV DEBFULLNAME "NVIDIA CORPORATION" +ENV DEBEMAIL "cudatools@nvidia.com" +ENV REVISION "$PKG_VERS-$PKG_REV" +ENV DISTRIB "UNRELEASED" +ENV SECTION "" + +# output directory +ENV DIST_DIR=/tmp/nvidia-container-runtime-$PKG_VERS +RUN mkdir -p $DIST_DIR + +# runc +WORKDIR $GOPATH/src/github.com/opencontainers/runc + +ARG RUNC_COMMIT +COPY runc/$RUNC_COMMIT/ /tmp/patches/runc +RUN git clone https://github.com/docker/runc.git . && \ + git checkout $RUNC_COMMIT && \ + git apply /tmp/patches/runc/* && \ + if [ -f vendor.conf ]; then vndr; fi && \ + make BUILDTAGS="seccomp apparmor selinux" && \ + mv runc $DIST_DIR/nvidia-container-runtime + +# nvidia-container-runtime-hook +COPY nvidia-container-runtime-hook/ $GOPATH/src/nvidia-container-runtime-hook + +RUN go get -v nvidia-container-runtime-hook && \ + mv $GOPATH/bin/nvidia-container-runtime-hook $DIST_DIR/nvidia-container-runtime-hook + +COPY config.toml.stretch $DIST_DIR/config.toml + +WORKDIR $DIST_DIR +COPY debian ./debian + +RUN dch --create --package nvidia-container-runtime -v "$REVISION" "v$REVISION" -D "$DISTRIB" && \ + dch -r "" + +CMD debuild -eSECTION --dpkg-buildpackage-hook='sh debian/prepare' -i -us -uc -b && \ + mv /tmp/nvidia-container-runtime_*.deb /dist diff --git a/Makefile b/Makefile index f6af40e..89c437d 100644 --- a/Makefile +++ b/Makefile @@ -10,12 +10,14 @@ DIST_DIR := $(CURDIR)/dist .NOTPARALLEL: .PHONY: all -all: xenial centos7 +all: xenial centos7 stretch xenial: 17.09.0-xenial 17.06.2-xenial 17.03.2-xenial 1.13.1-xenial 1.12.6-xenial centos7: 17.09.0-centos7 17.06.2-centos7 17.03.2-centos7 1.12.6-centos7 +stretch: 17.09.0-stretch 17.06.2-stretch 17.03.2-stretch + 17.09.0-xenial: $(DOCKER) build --build-arg RUNC_COMMIT="3f2f8b84a77f73d38244dd690525642a72156c64" \ --build-arg PKG_VERS="$(VERSION)+docker17.09.0" \ @@ -82,3 +84,24 @@ centos7: 17.09.0-centos7 17.06.2-centos7 17.03.2-centos7 1.12.6-centos7 --build-arg PKG_REV="$(PKG_REV).docker1.12.6" \ -t nvidia-container-runtime:$@ -f Dockerfile.centos7 . $(DOCKER) run --rm -v $(DIST_DIR)/centos7:/dist:Z nvidia-container-runtime:$@ + +17.09.0-stretch: + $(DOCKER) build --build-arg RUNC_COMMIT="3f2f8b84a77f73d38244dd690525642a72156c64" \ + --build-arg PKG_VERS="$(VERSION)+docker17.09.0" \ + --build-arg PKG_REV="$(PKG_REV)" \ + -t nvidia-container-runtime:$@ -f Dockerfile.stretch . + $(DOCKER) run --rm -v $(DIST_DIR)/stretch:/dist:Z nvidia-container-runtime:$@ + +17.06.2-stretch: + $(DOCKER) build --build-arg RUNC_COMMIT="810190ceaa507aa2727d7ae6f4790c76ec150bd2" \ + --build-arg PKG_VERS="$(VERSION)+docker17.06.2" \ + --build-arg PKG_REV="$(PKG_REV)" \ + -t nvidia-container-runtime:$@ -f Dockerfile.stretch . + $(DOCKER) run --rm -v $(DIST_DIR)/stretch:/dist:Z nvidia-container-runtime:$@ + +17.03.2-stretch: + $(DOCKER) build --build-arg RUNC_COMMIT="54296cf40ad8143b62dbcaa1d90e520a2136ddfe" \ + --build-arg PKG_VERS="$(VERSION)+docker17.03.2" \ + --build-arg PKG_REV="$(PKG_REV)" \ + -t nvidia-container-runtime:$@ -f Dockerfile.stretch . + $(DOCKER) run --rm -v $(DIST_DIR)/stretch:/dist:Z nvidia-container-runtime:$@ diff --git a/config.toml.stretch b/config.toml.stretch new file mode 100644 index 0000000..25e14d6 --- /dev/null +++ b/config.toml.stretch @@ -0,0 +1,8 @@ +#path = "/usr/bin/nvidia-container-cli" +environment = [] +load-kmods = true +disable-require = false +#debug = "/var/log/nvidia-container-runtime-hook.log" + +[configure] +ldconfig = "@/sbin/ldconfig" -- GitLab