Skip to content

Build Nvidia Docker Image #3326

Build Nvidia Docker Image

Build Nvidia Docker Image #3326

Workflow file for this run

name: Build Nvidia Docker Image
# This workflow is triggered on a schedule and can also be triggered manually
on:
schedule:
# Every 4 hours
- cron: '0 */4 * * *'
workflow_dispatch:
inputs:
stream:
description: 'Flatcar Stream'
required: true
default: 'stable'
jobs:
build:
# outputs:
# status: ${{ steps.early.conclusion }}
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
flatcar_track: ['stable', 'beta']
# nvidia_driver_version: ['440.64']
# nvidia_driver_version should be taken from the following url (change to the correct branch)
# https://github.com/flatcar-linux/coreos-overlay/blob/main/x11-drivers/nvidia-metadata/files/nvidia-metadata
# https://github.com/flatcar/scripts/blob/main/sdk_container/src/third_party/coreos-overlay/x11-drivers/nvidia-drivers/files/nvidia-metadata
include:
- flatcar_track: 'stable'
nvidia_driver_version: '535.104.05'
- flatcar_track: 'beta'
nvidia_driver_version: '535.104.05'
env:
DOCKER_HUB_USERNAME: 'mediadepot'
DOCKER_HUB_REPO: 'flatcar-nvidia-driver'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download and Build Nvidia Drivers
run: |
echo "=========================== Check ==========================="
curl https://${{matrix.flatcar_track}}.release.flatcar-linux.net/amd64-usr/current/version.txt -o version.txt
cat version.txt
export $(cat version.txt | xargs)
if [ "${{github.event_name}}" != "workflow_dispatch" ]; then
curl -s https://hub.docker.com/v2/repositories/${DOCKER_HUB_USERNAME}/${DOCKER_HUB_REPO}/tags/?page_size=10000 |
jq -e "[.results | .[] | .name == \"flatcar_${FLATCAR_VERSION}-nvidia_latest\"] | any | not" || (echo "Tag 'flatcar_${FLATCAR_VERSION}-nvidia_latest' already exists" && exit 0);
fi
echo "=========================== Build Nvidia Driver Image ==========================="
docker build \
--build-arg NVIDIA_DRIVER_VERSION=${{matrix.nvidia_driver_version}} \
--build-arg FLATCAR_VERSION=${FLATCAR_VERSION} \
--tag ${DOCKER_HUB_USERNAME}/${DOCKER_HUB_REPO}:flatcar_${FLATCAR_VERSION}-nvidia_latest \
--tag ${DOCKER_HUB_USERNAME}/${DOCKER_HUB_REPO}:flatcar_${FLATCAR_VERSION}-nvidia_${{matrix.nvidia_driver_version}} \
--tag ghcr.io/${DOCKER_HUB_USERNAME}/flatcar-nvidia-driver:flatcar_${FLATCAR_VERSION}-nvidia_latest \
.
echo "=========================== Push Images ==========================="
echo ${{ secrets.DOCKER_HUB_PASSWORD }} | docker login -u="analogj" --password-stdin
docker push ${DOCKER_HUB_USERNAME}/${DOCKER_HUB_REPO}:flatcar_${FLATCAR_VERSION}-nvidia_latest
docker push ${DOCKER_HUB_USERNAME}/${DOCKER_HUB_REPO}:flatcar_${FLATCAR_VERSION}-nvidia_${{matrix.nvidia_driver_version}}
echo ${{ secrets.USER_GITHUB_TOKEN }} | docker login ghcr.io -u="analogj" --password-stdin
docker push ghcr.io/${DOCKER_HUB_USERNAME}/flatcar-nvidia-driver:flatcar_${FLATCAR_VERSION}-nvidia_latest
- uses: gautamkrishnar/keepalive-workflow@v1 # using the workflow with default settings