Base (via push) #17
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: Base Image | |
run-name: Base (via ${{ github.event_name }}) | |
on: | |
push: | |
branches: | |
- "main" | |
- "release" | |
paths: | |
- ".github/workflows/build-push-base.yaml" | |
- "docker/base/*" | |
- "docker-bake.hcl" | |
- "docker-compose.base.yml" | |
- "!**.md" | |
workflow_dispatch: | |
inputs: | |
force-push: | |
description: "push to GHCR" | |
type: boolean | |
required: true | |
default: false | |
pull_request: | |
paths: | |
- ".github/workflows/build-push-base.yaml" | |
- "docker/base/*" | |
- "docker-bake.hcl" | |
- "docker-compose.base.yml" | |
- "!**.md" | |
defaults: | |
run: | |
shell: bash | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}-base | |
cancel-in-progress: true | |
env: | |
IMAGE_REGISTRY: ghcr.io | |
IMAGE_PLATFORMS: "linux/amd64" | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
strategy: | |
fail-fast: false | |
max-parallel: 1 | |
matrix: | |
include: | |
- target: base | |
cuda-ver: "cu121" | |
torch-ver: "torch201" | |
- target: base | |
cuda-ver: "cu121" | |
torch-ver: "torch210" | |
- target: base | |
cuda-ver: "cu118" | |
torch-ver: "torch201" | |
- target: base | |
cuda-ver: "cu118" | |
torch-ver: "torch210" | |
- target: base | |
cuda-ver: "cu121" | |
torch-ver: "nightly" | |
steps: | |
- name: Checkout | |
id: checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
platforms: ${{ env.IMAGE_PLATFORMS }} | |
- name: Log in to GHCR | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.IMAGE_REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate docker tags | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
flavor: | | |
suffix=-${{ matrix.cuda-ver }}-${{ matrix.torch-ver }} | |
images: | | |
${{ env.IMAGE_REGISTRY }}/${{ github.repository }}/${{ matrix.target }} | |
tags: | | |
type=raw,value=latest,enable={{is_default_branch}} | |
type=schedule,pattern={{date 'YYYYMMDD-hhmm' tz='UTC'}},enable={{is_default_branch}} | |
type=sha,format=short | |
type=ref,event=tag | |
type=ref,event=pr | |
labels: | | |
org.opencontainers.image.title=tensorpods-base | |
org.opencontainers.image.description=base PyTorch nVidia CUDA image | |
org.opencontainers.image.vendor=neggles.dev | |
- name: Build & Push Image | |
id: build-push | |
uses: docker/bake-action@v3 | |
with: | |
targets: ${{ matrix.target }}-${{ matrix.cuda-ver }}-${{ matrix.torch-ver }} | |
files: | | |
./docker-bake.hcl | |
${{ steps.meta.outputs.bake-file }} | |
push: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || inputs.force-push }} | |
set: | | |
*.cache-from=type=gha | |
*.cache-to=type=gha,mode=min |