name: BuildKiteLinuxAMD64GPUBootstrap
description: Set up worker image for linux-amd64-gpu pipeline
schemaVersion: 1.0

phases:
  - name: build
    steps:
      - name: SetupStep
        action: ExecuteBash
        inputs:
          commands:
            - |
              yum groupinstall -y "Development tools"
              yum install -y kernel-devel-$(uname -r)
              dnf install -y kernel-modules-extra
              aws s3 cp --recursive s3://ec2-linux-nvidia-drivers/latest/ .
              chmod +x NVIDIA-Linux-x86_64*.run
              ./NVIDIA-Linux-x86_64*.run --silent

              curl -s -L https://nvidia.github.io/libnvidia-container/stable/rpm/nvidia-container-toolkit.repo | tee /etc/yum.repos.d/nvidia-container-toolkit.repo
              yum install -y nvidia-container-toolkit
              yum clean expire-cache
              nvidia-ctk runtime configure --runtime=docker
              systemctl restart docker
