2020-05-14 19:27:34 +00:00
|
|
|
ARG BASEIMAGE
|
|
|
|
FROM ${BASEIMAGE}
|
2019-10-22 21:36:22 +00:00
|
|
|
|
2020-05-14 19:27:34 +00:00
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
2019-10-22 21:36:22 +00:00
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
wget \
|
|
|
|
ca-certificates \
|
|
|
|
git \
|
|
|
|
build-essential \
|
|
|
|
dh-make \
|
|
|
|
fakeroot \
|
|
|
|
devscripts \
|
|
|
|
lsb-release && \
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
RUN echo "deb http://ftp.debian.org/debian $(lsb_release -cs)-backports main" > /etc/apt/sources.list.d/backports.list
|
|
|
|
|
|
|
|
ARG GOLANG_VERSION=0.0.0
|
|
|
|
RUN set -eux; \
|
|
|
|
\
|
|
|
|
arch="$(uname -m)"; \
|
|
|
|
case "${arch##*-}" in \
|
|
|
|
x86_64 | amd64) ARCH='amd64' ;; \
|
|
|
|
ppc64el | ppc64le) ARCH='ppc64le' ;; \
|
|
|
|
aarch64) ARCH='arm64' ;; \
|
|
|
|
*) echo "unsupported architecture" ; exit 1 ;; \
|
|
|
|
esac; \
|
|
|
|
wget -nv -O - https://storage.googleapis.com/golang/go${GOLANG_VERSION}.linux-${ARCH}.tar.gz \
|
|
|
|
| tar -C /usr/local -xz
|
|
|
|
|
|
|
|
ENV GOPATH /go
|
|
|
|
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
|
|
|
|
|
|
|
|
# packaging
|
2022-05-18 11:55:05 +00:00
|
|
|
ARG PKG_NAME
|
2019-10-22 21:36:22 +00:00
|
|
|
ARG PKG_VERS
|
|
|
|
ARG PKG_REV
|
|
|
|
|
|
|
|
ENV DEBFULLNAME "NVIDIA CORPORATION"
|
|
|
|
ENV DEBEMAIL "cudatools@nvidia.com"
|
|
|
|
ENV REVISION "$PKG_VERS-$PKG_REV"
|
|
|
|
ENV SECTION ""
|
|
|
|
|
|
|
|
# output directory
|
|
|
|
ENV DIST_DIR=/tmp/nvidia-container-toolkit-$PKG_VERS
|
|
|
|
RUN mkdir -p $DIST_DIR /dist
|
|
|
|
|
|
|
|
# nvidia-container-toolkit
|
2020-04-12 00:18:00 +00:00
|
|
|
WORKDIR $GOPATH/src/nvidia-container-toolkit
|
|
|
|
COPY . .
|
2019-10-22 21:36:22 +00:00
|
|
|
|
2022-05-12 12:19:29 +00:00
|
|
|
ARG GIT_COMMIT
|
|
|
|
ENV GIT_COMMIT ${GIT_COMMIT}
|
2021-09-06 11:45:46 +00:00
|
|
|
RUN make PREFIX=${DIST_DIR} cmds
|
2019-10-22 21:36:22 +00:00
|
|
|
|
2021-11-09 20:20:39 +00:00
|
|
|
ARG CONFIG_TOML_SUFFIX
|
|
|
|
ENV CONFIG_TOML_SUFFIX ${CONFIG_TOML_SUFFIX}
|
|
|
|
COPY config/config.toml.${CONFIG_TOML_SUFFIX} $DIST_DIR/config.toml
|
2019-10-22 21:36:22 +00:00
|
|
|
|
|
|
|
# Debian Jessie still had ldconfig.real
|
|
|
|
RUN if [ "$(lsb_release -cs)" = "jessie" ]; then \
|
|
|
|
sed -i 's;"@/sbin/ldconfig";"@/sbin/ldconfig.real";' $DIST_DIR/config.toml; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
WORKDIR $DIST_DIR
|
2020-04-12 00:18:00 +00:00
|
|
|
COPY packaging/debian ./debian
|
2019-10-22 21:36:22 +00:00
|
|
|
|
2022-05-18 11:55:05 +00:00
|
|
|
RUN dch --create --package="${PKG_NAME}" \
|
|
|
|
--newversion "${REVISION}" \
|
2022-05-18 13:16:32 +00:00
|
|
|
"See https://gitlab.com/nvidia/container-toolkit/container-toolkit/-/blob/${GIT_COMMIT}/CHANGELOG.md for the changelog" && \
|
2022-05-18 11:55:05 +00:00
|
|
|
dch --append "Bump libnvidia-container dependency to ${REVISION}" && \
|
|
|
|
dch -r "" && \
|
2019-10-22 21:36:22 +00:00
|
|
|
if [ "$REVISION" != "$(dpkg-parsechangelog --show-field=Version)" ]; then exit 1; fi
|
|
|
|
|
2020-07-08 16:21:23 +00:00
|
|
|
CMD export DISTRIB="$(lsb_release -cs)" && \
|
2021-09-23 19:34:09 +00:00
|
|
|
debuild -eDISTRIB -eSECTION -eLIBNVIDIA_CONTAINER_VERSION="${REVISION}" \
|
|
|
|
--dpkg-buildpackage-hook='sh debian/prepare' -i -us -uc -b && \
|
2019-10-22 21:36:22 +00:00
|
|
|
mv /tmp/nvidia-container-toolkit_*.deb /dist
|