Skip to content

GPU Image

GPU Image #51

name: Docker GPU Image
on:
workflow_dispatch: null
push:
paths: ['images/*']
jobs:
build:
runs-on: ubuntu-latest
permissions: write-all
steps:
# For biggish images, github actions runs out of disk space.
# So we cleanup some unwanted things in the disk image, and reclaim that space for our docker use
# https://github.com/actions/virtual-environments/issues/2606#issuecomment-772683150
# and https://github.com/easimon/maximize-build-space/blob/b4d02c14493a9653fe7af06cc89ca5298071c66e/action.yml#L104
# This gives us a total of about 52G of free space, which should be enough for now
- name: cleanup disk space
run: |
sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc
df -h
- name: relocate docker data-dir
run: |
sudo sed -i 's#^{#{"data-root":"/mnt/docker",#' /etc/docker/daemon.json
sudo systemctl restart docker
- uses: actions/checkout@v3
- name: Login to GitHub Container Registry
if: github.repository == 'boettiger-lab/k8s'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Build the Docker image
if: github.repository == 'boettiger-lab/k8s'
run: docker build images/ -f images/Dockerfile.gpu --tag ghcr.io/boettiger-lab/k8s-gpu:latest
- name: Publish
if: github.repository == 'boettiger-lab/k8s'
run: docker push ghcr.io/boettiger-lab/k8s-gpu:latest
# Lets us monitor disks getting full as images get bigger over time
- name: Show how much disk space is left
run: df -h