Bump nvidia/cuda from 12.4.1-base-ubuntu22.04 to 12.5.1-base-ubuntu22.04 #101
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Image CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check token is set | |
id: vars | |
shell: bash | |
run: | | |
unset HAS_SECRET | |
if [[ -n $SECRET ]]; then HAS_SECRET='true'; else HAS_SECRET='false'; fi | |
echo "HAS_SECRET_TOKEN=${HAS_SECRET}" >> $GITHUB_OUTPUT | |
env: | |
SECRET: ${{ secrets.DOCKER_TOKEN }} | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Convert username to lower case for Docker | |
id: string_user | |
uses: ASzc/change-string-case-action@v6 | |
with: | |
string: ${{ github.repository_owner }} | |
- name: Convert repo to lower case for Docker | |
id: string_repo | |
uses: ASzc/change-string-case-action@v6 | |
with: | |
string: ${{ github.repository }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
if: ${{ steps.vars.outputs.HAS_SECRET_TOKEN == 'true' }} | |
uses: docker/login-action@v3 | |
with: | |
registry: docker.io | |
username: ${{ vars.DOCKER_USERNAME || steps.string_user.outputs.lowercase }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Set Docker name with owner (package name) depending on if DOCKER_USERNAME is set | |
id: docker_repo | |
shell: bash | |
run: | | |
if [[ -z $DOCKER_USERNAME ]]; then | |
echo "DOCKER_NWO=${GITHUB_NWO}" >> $GITHUB_OUTPUT | |
else | |
IFS='/' read -ra NWO_SPLIT <<< "$GITHUB_NWO" | |
REPO_NAME=${NWO_SPLIT[1]} | |
echo "DOCKER_NWO=${DOCKER_USERNAME}/${REPO_NAME}" >> $GITHUB_OUTPUT | |
fi | |
env: | |
DOCKER_USERNAME: ${{ vars.DOCKER_USERNAME }} | |
GITHUB_NWO: ${{ steps.string_repo.outputs.lowercase }} | |
- name: Get tag name | |
id: tags | |
shell: bash | |
run: | | |
tags=( ) | |
gittag="$(git tag --points-at HEAD)" | |
branch="$(git rev-parse --abbrev-ref HEAD)" | |
if [[ -n "${gittag}" ]]; then | |
tags=( "${tags[@]}" "${REPO_NAME}:${gittag}" ) | |
fi | |
if [[ -n "${branch}" ]]; then | |
branch="$(echo "${branch}" | sed -E 's|[/]|-|g')" | |
tags=( "${tags[@]}" "${REPO_NAME}:${branch}" ) | |
if [ "${branch}" == "master" ]; then | |
tags=( "${tags[@]}" "${tags},${REPO_NAME}:latest" ) | |
fi | |
fi | |
function join_by { | |
local d=${1-} f=${2-} | |
if shift 2; then | |
printf %s "$f" "${@/#/$d}" | |
fi | |
} | |
tagstr="$(join_by "," "${tags[@]}")" | |
echo "TAGS=${tagstr}" | |
echo "TAGS=${tagstr}" >> "${GITHUB_OUTPUT}" | |
env: | |
REPO_NAME: ${{ steps.docker_repo.outputs.DOCKER_NWO }} | |
- name: Build & optionally push to Docker Hub | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: ${{ steps.vars.outputs.HAS_SECRET_TOKEN == 'true' && github.event_name != 'pull_request' }} | |
file: Dockerfile | |
tags: ${{ steps.tags.outputs.TAGS }} | |
build-args: REPO=${{ github.repository }}, OWNER=${{ vars.DOCKER_USERNAME || github.repository_owner }} | |
env: | |
DOCKER_BUILDKIT: 1 |