Merge pull request #14 from AuScalableDroneCloud/feat/gpu #162
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: Create and publish Docker images | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
release: | |
types: [published] | |
jobs: | |
push_to_registry: | |
name: Build and push Docker image to GitHub Packages | |
runs-on: ubuntu-latest | |
steps: | |
#https://saturncloud.io/blog/github-action-ecr-optimizing-disk-space/#handling-or-maximizing-github-runner-out-of-disk-space-error | |
# Clean unnecessary files to save disk space | |
- name: clean unncessary files to save space | |
run: | | |
docker rmi `docker images -q` | |
sudo rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/sudo apt/sources.list.d | |
sudo apt -y autoremove --purge | |
sudo apt -y autoclean | |
sudo apt clean | |
rm --recursive --force "$AGENT_TOOLSDIRECTORY" | |
df -h | |
# Free up disk space on Ubuntu | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@main | |
with: | |
# This might remove tools that are actually needed, if set to "true" but frees about 6 GB | |
tool-cache: false | |
large-packages: true | |
swap-storage: true | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
# - name: update-base | |
# run: ./update_base.sh | |
# shell: bash | |
- name: Add SHORT_SHA env property with commit short sha | |
run: echo "SHORT_SHA=`git rev-parse --short HEAD`" >> $GITHUB_ENV | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver: docker # defaults to "docker-containerized" | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Intermediate images used as base images | |
- name: Build docker-stacks-foundation image | |
uses: docker/build-push-action@v5 | |
with: | |
build-args: | | |
ROOT_CONTAINER=nvidia/cuda:11.7.1-cudnn8-runtime-ubuntu22.04 | |
context: ./docker-stacks-main/images/docker-stacks-foundation | |
push: false | |
tags: docker-stacks-foundation | |
- name: Build base-notebook image | |
uses: docker/build-push-action@v5 | |
with: | |
build-args: | | |
BASE_CONTAINER=docker-stacks-foundation | |
context: ./docker-stacks-main/images/base-notebook | |
push: false | |
tags: base-notebook | |
- name: Build minimal-notebook image | |
uses: docker/build-push-action@v5 | |
with: | |
build-args: | | |
BASE_CONTAINER=base-notebook | |
context: ./docker-stacks-main/images/minimal-notebook | |
push: false | |
tags: minimal-notebook | |
# Published pipeline images | |
# CPU ONLY IMAGE - based on default jupyterhub docker stacks | |
- name: Extract metadata for pipeline-base | |
id: meta-base | |
uses: docker/metadata-action@v5 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
ghcr.io/auscalabledronecloud/pipeline-base | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=tag | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=sha | |
${{ env.SHORT_SHA }}-${{ github.run_number }} | |
- name: Build and push pipeline-base image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./base | |
push: true | |
tags: | | |
ghcr.io/auscalabledronecloud/pipeline-base:latest | |
${{ steps.meta-base.outputs.tags }} | |
labels: ${{ steps.meta-base.outputs.labels }} | |
- name: Extract metadata for pipeline-gpu | |
id: meta-gpu | |
uses: docker/metadata-action@v5 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
ghcr.io/auscalabledronecloud/pipeline-gpu | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=tag | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=sha | |
${{ env.SHORT_SHA }}-${{ github.run_number }} | |
- name: Build and push pipeline-gpu image | |
uses: docker/build-push-action@v5 | |
with: | |
build-args: | | |
BASE_CONTAINER=docker-stacks-foundation | |
GPU=true | |
context: ./base | |
push: true | |
tags: | | |
ghcr.io/auscalabledronecloud/pipeline-gpu:latest | |
${{ steps.meta-gpu.outputs.tags }} | |
labels: ${{ steps.meta-base.outputs.labels }} | |
- name: Extract metadata for pipeline-ml | |
id: meta-ml | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/auscalabledronecloud/pipeline-ml | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=tag | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=sha | |
${{ env.SHORT_SHA }}-${{ github.run_number }} | |
- name: Build and push pipeline-ml image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./ml | |
push: true | |
tags: | | |
ghcr.io/auscalabledronecloud/pipeline-ml:latest | |
${{ steps.meta-ml.outputs.tags }} | |
labels: ${{ steps.meta-ml.outputs.labels }} |