2020-05-14 19:27:34 +00:00
|
|
|
ARG BASEIMAGE
|
|
|
|
FROM ${BASEIMAGE}
|
2019-10-22 21:36:22 +00:00
|
|
|
|
|
|
|
RUN zypper install -y \
|
|
|
|
ca-certificates \
|
|
|
|
wget \
|
|
|
|
git \
|
|
|
|
rpm-build && \
|
|
|
|
rm -rf /var/cache/zypp/*
|
|
|
|
|
|
|
|
ARG GOLANG_VERSION=0.0.0
|
|
|
|
RUN set -eux; \
|
|
|
|
\
|
|
|
|
arch="$(uname -m)"; \
|
|
|
|
case "${arch##*-}" in \
|
|
|
|
x86_64 | amd64) ARCH='amd64' ;; \
|
|
|
|
ppc64el | ppc64le) ARCH='ppc64le' ;; \
|
2024-02-28 19:43:48 +00:00
|
|
|
aarch64 | arm64) ARCH='arm64' ;; \
|
2019-10-22 21:36:22 +00:00
|
|
|
*) 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
|
2022-08-23 19:15:41 +00:00
|
|
|
ENV PKG_NAME ${PKG_NAME}
|
|
|
|
ENV PKG_VERS ${PKG_VERS}
|
|
|
|
ENV PKG_REV ${PKG_REV}
|
2019-10-22 21:36:22 +00:00
|
|
|
|
|
|
|
# output directory
|
|
|
|
ENV DIST_DIR=/tmp/nvidia-container-toolkit-$PKG_VERS/SOURCES
|
|
|
|
RUN mkdir -p $DIST_DIR /dist
|
|
|
|
|
|
|
|
# nvidia-container-toolkit
|
2020-04-12 00:18:00 +00:00
|
|
|
WORKDIR $GOPATH/src/nvidia-container-toolkit
|
|
|
|
COPY . .
|
|
|
|
|
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
|
|
|
|
|
|
|
WORKDIR $DIST_DIR/..
|
2020-04-12 00:18:00 +00:00
|
|
|
COPY packaging/rpm .
|
2019-10-22 21:36:22 +00:00
|
|
|
|
2022-06-13 13:41:35 +00:00
|
|
|
ARG LIBNVIDIA_CONTAINER_TOOLS_VERSION
|
|
|
|
ENV LIBNVIDIA_CONTAINER_TOOLS_VERSION ${LIBNVIDIA_CONTAINER_TOOLS_VERSION}
|
|
|
|
|
2019-10-22 21:36:22 +00:00
|
|
|
CMD arch=$(uname -m) && \
|
|
|
|
rpmbuild --clean --target=$arch -bb \
|
|
|
|
-D "_topdir $PWD" \
|
2022-05-18 11:55:05 +00:00
|
|
|
-D "release_date $(date +'%a %b %d %Y')" \
|
2022-05-18 13:16:32 +00:00
|
|
|
-D "git_commit ${GIT_COMMIT}" \
|
2022-08-23 19:15:41 +00:00
|
|
|
-D "version ${PKG_VERS}" \
|
2022-06-13 13:41:35 +00:00
|
|
|
-D "libnvidia_container_tools_version ${LIBNVIDIA_CONTAINER_TOOLS_VERSION}" \
|
2022-08-23 19:15:41 +00:00
|
|
|
-D "release ${PKG_REV}" \
|
2019-10-22 21:36:22 +00:00
|
|
|
SPECS/nvidia-container-toolkit.spec && \
|
|
|
|
mv RPMS/$arch/*.rpm /dist
|