Skip to content

Commit

Permalink
NVIDIA Driver (#13)
Browse files Browse the repository at this point in the history
* NVIDIA Driver

* fixing chmod

* hmmm

* script should be executable derp

* labels

* tag requires ubuntu18.04

* fixing tag

* dirty image wouldnt work w/ operator
  • Loading branch information
onelapahead authored Feb 15, 2021
1 parent e0d8e4a commit e05cef8
Show file tree
Hide file tree
Showing 10 changed files with 583 additions and 3 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/nvidia-driver-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: "NVIDIA Driver"
on:
pull_request:
branches:
- '**'
paths:
- 'nvidia-driver/*'
- .github/workflows/nvidia-driver-build.yml
push:
branches:
- main
paths:
- 'nvidia-driver/*'
- .github/workflows/nvidia-driver-build.yml
jobs:
ci:
runs-on: ubuntu-18.04
name: CI
steps:
- name: git checkout
uses: actions/checkout@v2

- name: extract versions
id: versions
run: |
version=$(cat VERSION)
echo "::set-output name=git-tag::nvidia-driver-v${version}"
echo "::set-output name=version::v${version}"
echo "::set-output name=image-version::v${version}-ubuntu18.04"
echo "::set-output name=dirty-image-version::v${version}-$(git rev-parse --short HEAD)-ubuntu18.04"
working-directory: nvidia-driver

- name: docker login
uses: azure/docker-login@v1
with:
login-server: ghcr.io
username: hfuss
password: ${{ secrets.PACKAGES_TOKEN }}

- name: build and test
run: |
docker build . -t ghcr.io/hfuss/nvidia-driver:${{ steps.versions.outputs.dirty-image-version }}
docker push ghcr.io/hfuss/nvidia-driver:${{ steps.versions.outputs.dirty-image-version }}
working-directory: nvidia-driver

- name: enforce new version
run: |
git ls-remote --exit-code origin --tags '${{ steps.versions.outputs.git-tag }}' && found=true
if [[ "${found}" == "true" ]]; then
echo "${{ steps.versions.outputs.git-tag }} tag already exists, please update the version and changelog"
exit 1
fi
- name: enforce changelog
if: ${{ github.event_name == 'pull_request' }}
uses: dangoslen/changelog-enforcer@v2
with:
changeLogPath: 'nvidia-driver/CHANGELOG.md'
skipLabels: 'Skip-Changelog'
expectedLatestVersion: ${{ steps.versions.outputs.version }}

- name: extract changelog
id: changelog
uses: mindsers/changelog-reader-action@v2
with:
validation_depth: 10
version: ${{ steps.versions.outputs.version }}
path: nvidia-driver/CHANGELOG.md

- name: tag images
run: |
docker tag ghcr.io/hfuss/nvidia-driver:${{ steps.versions.outputs.dirty-image-version }} ghcr.io/hfuss/nvidia-driver:${{ steps.versions.outputs.image-version }}
docker tag ghcr.io/hfuss/nvidia-driver:${{ steps.versions.outputs.dirty-image-version }} ghcr.io/hfuss/nvidia-driver:latest
- name: promote images
if: ${{ github.event_name == 'push' }}
run: |
docker push ghcr.io/hfuss/nvidia-driver:${{ steps.versions.outputs.image-version }}
docker push ghcr.io/hfuss/nvidia-driver:latest
- name: git release
uses: actions/create-release@v1
if: ${{ github.event_name == 'push' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ steps.versions.outputs.git-tag }}
release_name: NVIDIA Driver ${{ steps.versions.outputs.version }} Release
body: ${{ steps.changelog.outputs.changes }}
draft: false
prerelease: false
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@
# Dependency directories (remove the comment below to include it)
# vendor/

**/build/_output/
**/build/_output/

*.iml
.idea/
9 changes: 9 additions & 0 deletions miner/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Dependencies
- ...

## [v0.4.0]
### Changed
- Decreasing the final image size using the `base` image rather than
the `devel` image required for building

### Dependencies
- Base image `docker.io/nvidia/cuda:11.2-base-ubuntu18.04`


## [v0.3.0]
### Changed
- Using up-to-date [`nsfminer`](https://github.com/no-fee-ethereum-mining/nsfminer) instead of [`ethminer`](https://github.com/ethereum-mining/ethminer)
Expand Down
2 changes: 1 addition & 1 deletion miner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN apt-get install -y curl \
&& mv nsfminer /usr/local/bin/ \
&& rm -rf *

FROM base as final
FROM docker.io/nvidia/cuda:11.2.0-base-ubuntu18.04 as final

COPY --from=ethminer /usr/local/bin/nsfminer /usr/local/bin/nsfminer
RUN ln -sf /usr/local/bin/nsfminer /usr/local/bin/ethminer
Expand Down
2 changes: 1 addition & 1 deletion miner/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.0
0.4.0
24 changes: 24 additions & 0 deletions nvidia-driver/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# CHANGELOG

Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## Unreleased
### Added
- ...

### Changed
- ...

### Removed
- ...

### Dependencies
- ...

## [v0.1.0]
### Added
- Custom NVIDIA driver image

### Dependencies
- Base image `docker.io/nvidia/cuda:11.2-base-ubuntu18.04`
- NVIDIA Driver `460.32.03`
65 changes: 65 additions & 0 deletions nvidia-driver/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# https://docs.nvidia.com/datacenter/cloud-native/gpu-operator/getting-started.html#install-the-gpu-operator
# https://gitlab.com/nvidia/container-images/driver/-/blob/b9736822af4c0530c80db3335c0ecbd5ac36d4c8/ubuntu18.04/
FROM docker.io/nvidia/cuda:11.2.0-base-ubuntu18.04
LABEL [email protected]
LABEL org.opencontainers.image.source=https://github.com/hfuss/ethernetes

RUN dpkg --add-architecture i386 && \
apt-get update && apt-get install -y --no-install-recommends \
apt-utils \
build-essential \
ca-certificates \
curl \
kmod \
libc6:i386 \
libelf-dev \
libglvnd-dev\
pkg-config && \
rm -rf /var/lib/apt/lists/*

RUN echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic main universe" > /etc/apt/sources.list && \
echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic-updates main universe" >> /etc/apt/sources.list && \
echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic-security main universe" >> /etc/apt/sources.list && \
usermod -o -u 0 -g 0 _apt

RUN curl -fsSL -o /usr/local/bin/donkey https://github.com/3XX0/donkey/releases/download/v1.1.0/donkey && \
curl -fsSL -o /usr/local/bin/extract-vmlinux https://raw.githubusercontent.com/torvalds/linux/master/scripts/extract-vmlinux && \
chmod +x /usr/local/bin/donkey /usr/local/bin/extract-vmlinux

#ARG BASE_URL=http://us.download.nvidia.com/XFree86/Linux-x86_64
ARG BASE_URL=https://us.download.nvidia.com/tesla
ARG DRIVER_VERSION=460.32.03
ENV DRIVER_VERSION=$DRIVER_VERSION
ENV DEBIAN_FRONTEND=noninteractive

# Install the userspace components and copy the kernel module sources.
RUN cd /tmp && \
curl -fSsl -O $BASE_URL/$DRIVER_VERSION/NVIDIA-Linux-x86_64-$DRIVER_VERSION.run && \
sh NVIDIA-Linux-x86_64-$DRIVER_VERSION.run -x && \
cd NVIDIA-Linux-x86_64-$DRIVER_VERSION* && \
./nvidia-installer --silent \
--no-kernel-module \
--install-compat32-libs \
--no-nouveau-check \
--no-nvidia-modprobe \
--no-rpms \
--no-backup \
--no-check-for-alternate-installs \
--no-libglx-indirect \
--no-install-libglvnd \
--x-prefix=/tmp/null \
--x-module-path=/tmp/null \
--x-library-path=/tmp/null \
--x-sysconfig-path=/tmp/null && \
mkdir -p /usr/src/nvidia-$DRIVER_VERSION && \
mv LICENSE mkprecompiled kernel /usr/src/nvidia-$DRIVER_VERSION && \
sed '9,${/^\(kernel\|LICENSE\)/!d}' .manifest > /usr/src/nvidia-$DRIVER_VERSION/.manifest && \
rm -rf /tmp/*

COPY nvidia-driver /usr/local/bin
WORKDIR /usr/src/nvidia-$DRIVER_VERSION

ARG PUBLIC_KEY=empty
COPY ${PUBLIC_KEY} kernel/pubkey.x509

ENTRYPOINT ["nvidia-driver", "init"]
1 change: 1 addition & 0 deletions nvidia-driver/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.0
Empty file added nvidia-driver/empty
Empty file.
Loading

0 comments on commit e05cef8

Please sign in to comment.