# nvidia-docker需要安装，外挂的形式
# https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html


distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
    && curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
    && curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | \
    sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
    sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list


sudo apt-get update
apt-get install -y nvidia-container-toolkit



curl -s -L https://nvidia.github.io/libnvidia-container/stable/rpm/nvidia-container-toolkit.repo | \
  sudo tee /etc/yum.repos.d/nvidia-container-toolkit.repo

sudo yum install -y nvidia-container-toolkit


nvidia-ctk runtime configure --runtime=docker
systemctl restart docker


export gdr_server=(gdr-hard-decoder-server_v1.0.1-release.tar.gz pack_gdr_release_0724_x64.tar.gz pack_ts2mp4_x64-0724.tar.gz ts2mp4_docker_image_v1.tar.gz)
for gdr_file in ${gdr_server[*]} ; do
    echo ""
    echo "current gdr file is => ${gdr_file}"
    wget --no-check-certificate https://oss.demo.uavcmlc.com:18000/cmlc-installation/gdr_server/${gdr_file}
    echo ""
    echo ""
done


docker load < gdr-hard-decoder-server_v1.0.1-release.tar.gz
docker load < ts2mp4_docker_image_v1.tar.gz
