Skip to content

Docker Build

Docker Build #151

Workflow file for this run

name: Docker Build
on:
workflow_dispatch:
#push:
# branches: [ "main" ]
env:
UBUNTU_VERSION: 22.04
BUILDX_NO_DEFAULT_ATTESTATIONS: 1
jobs:
cpu-base:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# This is not as silly as it seems... We will build for ARM later and this will be useful
build:
- {latest: "false"}
steps:
-
name: Free Space
run: |
df -h
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/.ghcup
sudo rm -rf /usr/local/share/boost
sudo rm -rf /usr/local/lib/android
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
-
name: Env Setter
run: |
REPO=${GITHUB_REPOSITORY,,}
echo "REPO_NAMESPACE=${REPO%%/*}" >> ${GITHUB_ENV}
echo "REPO_NAME=${REPO#*/}" >> ${GITHUB_ENV}
-
name: Checkout
uses: actions/checkout@v3
-
name: Permissions fixes
run: |
target="${HOME}/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/build/COPY*"
chmod -R ug+rwX ${target}
-
name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Set tags
run: |
img_path_ghcr="ghcr.io/${{ env.REPO_NAMESPACE }}/${{ env.REPO_NAME }}"
img_path_dhub="${{ secrets.DOCKERHUB_USER }}/${{ env.REPO_NAME }}"
base_tag="v2-cpu-${{ env.UBUNTU_VERSION }}"
if [[ ${{ matrix.build.latest }} == "true" ]]; then
echo "Marking latest"
TAGS="${img_path_ghcr}:${base_tag}, ${img_path_ghcr}:latest-cpu"
TAGS="${TAGS}, ${img_path_dhub}:${base_tag}, ${img_path_dhub}:latest-cpu"
else
TAGS="${img_path_ghcr}:${base_tag}, ${img_path_dhub}:${base_tag}"
fi
echo "TAGS=${TAGS}" >> ${GITHUB_ENV}
-
name: Build and push
uses: docker/build-push-action@v4
with:
context: build
build-args: |
IMAGE_BASE=ubuntu:${{ env.UBUNTU_VERSION }}
XPU_TARGET=CPU
push: true
# Avoids unknown/unknown architecture and extra metadata
provenance: false
tags: ${{ env.TAGS }}
nvidia-base:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
build:
- {latest: "false", cuda: "11.8.0-base"}
- {latest: "false", cuda: "11.8.0-cudnn8-runtime"}
- {latest: "false", cuda: "11.8.0-cudnn8-devel"}
- {latest: "false", cuda: "12.1.1-base"}
- {latest: "false", cuda: "12.1.1-cudnn8-runtime"}
- {latest: "false", cuda: "12.1.1-cudnn8-devel"}
steps:
-
name: Free Space
run: |
df -h
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/.ghcup
sudo rm -rf /usr/local/share/boost
sudo rm -rf /usr/local/lib/android
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
-
name: Env Setter
run: |
REPO=${GITHUB_REPOSITORY,,}
echo "REPO_NAMESPACE=${REPO%%/*}" >> ${GITHUB_ENV}
echo "REPO_NAME=${REPO#*/}" >> ${GITHUB_ENV}
-
name: Checkout
uses: actions/checkout@v3
-
name: Permissions fixes
run: |
target="${HOME}/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/build/COPY*"
chmod -R ug+rwX ${target}
-
name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Set tags
run: |
img_path_ghcr="ghcr.io/${{ env.REPO_NAMESPACE }}/${{ env.REPO_NAME }}"
img_path_dhub="${{ secrets.DOCKERHUB_USER }}/${{ env.REPO_NAME }}"
base_tag="v2-cuda-${{ matrix.build.cuda }}-${{ env.UBUNTU_VERSION }}"
if [[ ${{ matrix.build.latest }} == "true" ]]; then
echo "Marking latest"
TAGS="${img_path_ghcr}:${base_tag}, ${img_path_ghcr}:latest-cuda"
TAGS="${TAGS}, ${img_path_dhub}:${base_tag}, ${img_path_dhub}:latest-cuda"
else
TAGS="${img_path_ghcr}:${base_tag}, ${img_path_dhub}:${base_tag}"
fi
echo "TAGS=${TAGS}" >> ${GITHUB_ENV}
-
name: Build and push
uses: docker/build-push-action@v4
with:
context: build
build-args: |
IMAGE_BASE=nvidia/cuda:${{ matrix.build.cuda }}-ubuntu${{ env.UBUNTU_VERSION }}
XPU_TARGET=NVIDIA_GPU
CUDA_STRING=${{ matrix.build.cuda }}
push: true
provenance: false
tags: ${{ env.TAGS }}
amd-base:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
build:
- {latest: "false", rocm: "5.7-core"}
- {latest: "false", rocm: "5.7-runtime"}
- {latest: "false", rocm: "5.7-devel"}
- {latest: "false", rocm: "6.0-core"}
- {latest: "false", rocm: "6.0-runtime"}
- {latest: "false", rocm: "6.0-devel"}
steps:
-
name: Free Space
run: |
df -h
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/.ghcup
sudo rm -rf /usr/local/share/boost
sudo rm -rf /usr/local/lib/android
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
-
name: Env Setter
run: |
REPO=${GITHUB_REPOSITORY,,}
echo "REPO_NAMESPACE=${REPO%%/*}" >> ${GITHUB_ENV}
echo "REPO_NAME=${REPO#*/}" >> ${GITHUB_ENV}
-
name: Checkout
uses: actions/checkout@v3
-
name: Permissions fixes
run: |
target="${HOME}/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/build/COPY*"
chmod -R ug+rwX ${target}
-
name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Set tags
run: |
img_path_ghcr="ghcr.io/${{ env.REPO_NAMESPACE }}/${{ env.REPO_NAME }}"
img_path_dhub="${{ secrets.DOCKERHUB_USER }}/${{ env.REPO_NAME }}"
base_tag="v2-rocm-${{ matrix.build.rocm }}-${{ env.UBUNTU_VERSION }}"
if [[ ${{ matrix.build.latest }} == "true" ]]; then
echo "Marking latest"
TAGS="${img_path_ghcr}:${base_tag}, ${img_path_ghcr}:latest-rocm"
TAGS="${TAGS}, ${img_path_dhub}:${base_tag}, ${img_path_dhub}:latest-rocm"
else
TAGS="${img_path_ghcr}:${base_tag}, ${img_path_dhub}:${base_tag}"
fi
echo "TAGS=${TAGS}" >> ${GITHUB_ENV}
-
name: Build and push
uses: docker/build-push-action@v4
with:
context: build
build-args: |
IMAGE_BASE=ubuntu:${{ env.UBUNTU_VERSION }}
XPU_TARGET=AMD_GPU
ROCM_STRING=${{ matrix.build.rocm }}
push: true
provenance: false
tags: ${{ env.TAGS }}