Skip to content
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.

Commit

Permalink
Merge branch 'jetson-packaging' into 'master'
Browse files Browse the repository at this point in the history
Add support for building jetson packages

See merge request nvidia/container-toolkit/nvidia-docker!30
  • Loading branch information
Evan Lezar committed Nov 12, 2021
2 parents 9de312f + 8a2d09b commit 34934c2
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

LIB_NAME := nvidia-docker2
LIB_VERSION := 2.7.0
LIB_TAG := rc.2
LIB_TAG ?= rc.3

TOOLKIT_VERSION ?= 1.6.0
TOOLKIT_TAG ?= rc.2
Expand Down
4 changes: 4 additions & 0 deletions debian/changelog → debian/changelog.old
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
nvidia-docker2 (2.7.0~rc.3-1) UNRELEASED; urgency=medium

-- NVIDIA CORPORATION <[email protected]> Mon, 08 Nov 2021 14:54:46 +0100

nvidia-docker2 (2.7.0~rc.2-1) UNRELEASED; urgency=medium

* Allow the toolkit version to be specified as a variable
Expand Down
6 changes: 4 additions & 2 deletions docker/Dockerfile.amazonlinux
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ RUN yum install -y \
rm -rf /var/cache/yum/*

# packaging
ARG PKG_NAME
ARG PKG_VERS
ARG PKG_REV
ARG TOOLKIT_VERSION
ARG DOCKER_VERSION

ENV PKG_NAME "${PKG_NAME}"
ENV VERSION $PKG_VERS
ENV RELEASE $PKG_REV
ENV DOCKER_VERSION $DOCKER_VERSION
ENV TOOLKIT_VERSION $TOOLKIT_VERSION

# output directory
ENV DIST_DIR=/tmp/nvidia-docker2-$PKG_VERS/SOURCES
ENV DIST_DIR=/tmp/${PKG_NAME}-$PKG_VERS/SOURCES
RUN mkdir -p $DIST_DIR /dist

COPY nvidia-docker $DIST_DIR
Expand All @@ -35,5 +37,5 @@ CMD rpmbuild --clean -bb \
-D "release $RELEASE" \
-D "docker_version $DOCKER_VERSION" \
-D "toolkit_version $TOOLKIT_VERSION" \
SPECS/nvidia-docker2.spec && \
SPECS/${PKG_NAME}.spec && \
mv RPMS/noarch/*.rpm /dist
4 changes: 3 additions & 1 deletion docker/Dockerfile.centos
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ RUN yum install -y \
rm -rf /var/cache/yum/*

# packaging
ARG PKG_NAME
ARG PKG_VERS
ARG PKG_REV
ARG TOOLKIT_VERSION
ARG DOCKER_VERSION

ENV PKG_NAME "${PKG_NAME}"
ENV VERSION $PKG_VERS
ENV RELEASE $PKG_REV
ENV DOCKER_VERSION $DOCKER_VERSION
ENV TOOLKIT_VERSION $TOOLKIT_VERSION

# output directory
ENV DIST_DIR=/tmp/nvidia-docker2-$PKG_VERS/SOURCES
ENV DIST_DIR=/tmp/${PKG_NAME}-$PKG_VERS/SOURCES
RUN mkdir -p $DIST_DIR /dist

COPY nvidia-docker $DIST_DIR
Expand Down
10 changes: 7 additions & 3 deletions docker/Dockerfile.debian
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,22 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
rm -rf /var/lib/apt/lists/*

# packaging
ARG PKG_NAME
ARG PKG_VERS
ARG PKG_REV
ARG TOOLKIT_VERSION
ARG DOCKER_VERSION

ENV DEBFULLNAME "NVIDIA CORPORATION"
ENV DEBEMAIL "[email protected]"
ENV PKG_NAME "${PKG_NAME}"
ENV REVISION "$PKG_VERS-$PKG_REV"
ENV DOCKER_VERSION $DOCKER_VERSION
ENV TOOLKIT_VERSION $TOOLKIT_VERSION
ENV SECTION ""

# output directory
ENV DIST_DIR=/tmp/nvidia-docker2-$PKG_VERS
ENV DIST_DIR=/tmp/${PKG_NAME}-$PKG_VERS
RUN mkdir -p $DIST_DIR /dist

# nvidia-docker 2.0
Expand All @@ -36,8 +38,10 @@ COPY debian ./debian

RUN sed -i "s;@VERSION@;${PKG_VERS};" $DIST_DIR/nvidia-docker
RUN sed -i "s;@TOOLKIT_VERSION@;${TOOLKIT_VERSION};" debian/control && \
dch --changelog debian/changelog --append "Bump nvidia-container-toolkit dependency to ${TOOLKIT_VERSION}" && \
dch --changelog debian/changelog -r "" && \
dch --create --package="${PKG_NAME}" \
--newversion "${REVISION}" \
"Bump nvidia-container-toolkit dependency to ${TOOLKIT_VERSION}" && \
dch -r "" && \
if [ "$REVISION" != "$(dpkg-parsechangelog --show-field=Version)" ]; then exit 1; fi

CMD export DISTRIB="unstable" && \
Expand Down
6 changes: 4 additions & 2 deletions docker/Dockerfile.opensuse-leap
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ RUN zypper install -y \
rm -rf /var/cache/zypp/*

# packaging
ARG PKG_NAME
ARG PKG_VERS
ARG PKG_REV
ARG TOOLKIT_VERSION
ARG DOCKER_VERSION

ENV PKG_NAME "${PKG_NAME}"
ENV VERSION $PKG_VERS
ENV RELEASE $PKG_REV
ENV DOCKER_VERSION $DOCKER_VERSION
ENV TOOLKIT_VERSION $TOOLKIT_VERSION

# output directory
ENV DIST_DIR=/tmp/nvidia-docker2-$PKG_VERS/SOURCES
ENV DIST_DIR=/tmp/${PKG_NAME}-$PKG_VERS/SOURCES
RUN mkdir -p $DIST_DIR /dist

COPY nvidia-docker $DIST_DIR
Expand All @@ -35,5 +37,5 @@ CMD rpmbuild --clean -bb \
-D "release $RELEASE" \
-D "docker_version $DOCKER_VERSION" \
-D "toolkit_version $TOOLKIT_VERSION" \
SPECS/nvidia-docker2.spec && \
SPECS/${PKG_NAME}.spec && \
mv RPMS/noarch/*.rpm /dist
12 changes: 8 additions & 4 deletions docker/Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,22 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
rm -rf /var/lib/apt/lists/*

# packaging
ARG PKG_NAME
ARG PKG_VERS
ARG PKG_REV
ARG TOOLKIT_VERSION
ARG DOCKER_VERSION

ENV DEBFULLNAME "NVIDIA CORPORATION"
ENV DEBEMAIL "[email protected]"
ENV PKG_NAME "${PKG_NAME}"
ENV REVISION "$PKG_VERS-$PKG_REV"
ENV DOCKER_VERSION $DOCKER_VERSION
ENV TOOLKIT_VERSION $TOOLKIT_VERSION
ENV SECTION ""

# output directory
ENV DIST_DIR=/tmp/nvidia-docker2-$PKG_VERS
ENV DIST_DIR=/tmp/${PKG_NAME}-$PKG_VERS
RUN mkdir -p $DIST_DIR /dist

# nvidia-docker 2.0
Expand All @@ -37,9 +39,11 @@ COPY debian ./debian

RUN sed -i "s;@VERSION@;${PKG_VERS};" $DIST_DIR/nvidia-docker
RUN sed -i "s;@TOOLKIT_VERSION@;${TOOLKIT_VERSION};" debian/control && \
dch --changelog debian/changelog --append "Bump nvidia-container-toolkit dependency to ${TOOLKIT_VERSION}" && \
dch --changelog debian/changelog -r "" && \
if [ "$REVISION" != "$(dpkg-parsechangelog --show-field=Version)" ]; then echo "$(dpkg-parsechangelog --show-field=Version)" && exit 1; fi
dch --create --package="${PKG_NAME}" \
--newversion "${REVISION}" \
"Bump nvidia-container-toolkit dependency to ${TOOLKIT_VERSION}" && \
dch -r "" && \
if [ "$REVISION" != "$(dpkg-parsechangelog --show-field=Version)" ]; then exit 1; fi

CMD export DISTRIB="$(lsb_release -cs)" && \
debuild --preserve-env --dpkg-buildpackage-hook='sh debian/prepare' -i -us -uc -b && \
Expand Down
14 changes: 11 additions & 3 deletions docker/docker.mk
Original file line number Diff line number Diff line change
Expand Up @@ -148,20 +148,28 @@ RPM_TOOLKIT_REV := $(if $(TOOLKIT_TAG),0.1.$(TOOLKIT_TAG),1)
--opensuse-leap%: DOCKER_VERSION := docker >= 18.09.1_ce
--rhel%: DOCKER_VERSION := docker-ce >= 18.06.3.ce-3.el7

# Depending on the docker version we may have to add the platform args to the
# build and run commands
PLATFORM_ARGS ?= --platform=linux/$(ARCH)
ifneq ($(strip $(ADD_DOCKER_PLATFORM_ARGS)),)
DOCKER_PLATFORM_ARGS = $(PLATFORM_ARGS)
endif

docker-build-%:
@echo "Building for $(TARGET_PLATFORM)"
docker pull --platform=linux/$(ARCH) $(BASEIMAGE)
docker pull $(PLATFORM_ARGS) $(BASEIMAGE)
DOCKER_BUILDKIT=1 \
$(DOCKER) build \
$(DOCKER) build $(DOCKER_PLATFORM_ARGS) \
--progress=plain \
--build-arg BASEIMAGE="$(BASEIMAGE)" \
--build-arg DOCKER_VERSION="$(DOCKER_VERSION)" \
--build-arg TOOLKIT_VERSION="$(MIN_TOOLKIT_PKG_VERSION)" \
--build-arg PKG_NAME="$(LIB_NAME)" \
--build-arg PKG_VERS="$(LIB_VERSION)" \
--build-arg PKG_REV="$(PKG_REV)" \
--tag $(BUILDIMAGE) \
--file $(DOCKERFILE) .
$(DOCKER) run \
$(DOCKER) run $(DOCKER_PLATFORM_ARGS) \
-e DISTRIB \
-e SECTION \
-v $(ARTIFACTS_DIR):/dist \
Expand Down
2 changes: 2 additions & 0 deletions rpm/SPECS/nvidia-docker2.spec
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ install -m 644 -t %{buildroot}/etc/docker daemon.json
%config /etc/docker/daemon.json

%changelog
* Mon Nov 08 2021 NVIDIA CORPORATION <[email protected]> 2.7.0-0.1.rc.3

* Thu Nov 04 2021 NVIDIA CORPORATION <[email protected]> 2.7.0-0.1.rc.2
- Bump nvidia-container-toolkit dependency to %{toolkit_version}
- Allow the toolkit version to be specified as a variable
Expand Down

0 comments on commit 34934c2

Please sign in to comment.