mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-22 08:18:32 +00:00
61 lines
1.7 KiB
Docker
61 lines
1.7 KiB
Docker
|
ARG VERSION_ID
|
||
|
FROM ubuntu:${VERSION_ID}
|
||
|
|
||
|
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/*
|
||
|
|
||
|
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
|
||
|
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
|
||
|
COPY nvidia-container-toolkit/ $GOPATH/src/nvidia-container-toolkit
|
||
|
|
||
|
RUN go get -ldflags "-s -w" -v nvidia-container-toolkit && \
|
||
|
mv $GOPATH/bin/nvidia-container-toolkit $DIST_DIR/nvidia-container-toolkit
|
||
|
|
||
|
COPY config/config.toml.ubuntu $DIST_DIR/config.toml
|
||
|
|
||
|
WORKDIR $DIST_DIR
|
||
|
COPY pkg/debian ./debian
|
||
|
|
||
|
RUN sed -i "s;@VERSION@;${REVISION};" debian/changelog && \
|
||
|
if [ "$REVISION" != "$(dpkg-parsechangelog --show-field=Version)" ]; then exit 1; fi
|
||
|
|
||
|
CMD export DISTRIB="$(lsb_release -cs)" && \
|
||
|
debuild -eDISTRIB -eSECTION --dpkg-buildpackage-hook='sh debian/prepare' -i -us -uc -b && \
|
||
|
mv /tmp/*.deb /dist
|