Update build.yaml #2
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: Build and push container image | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
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: Checkout files in repo | |
uses: actions/checkout@main | |
- name: Build the image and push to quay.io if not a pull request | |
uses: jupyterhub/repo2docker-action@master | |
with: | |
# Don't push the image during a PR build | |
NO_PUSH: "${{ github.event_name == 'pull_request' }}" | |
# Make sure username & password/token pair matches your registry credentials | |
DOCKER_USERNAME: ${{github.actor}} | |
DOCKER_PASSWORD: ${{secrets.GITHUB_TOKEN}} | |
DOCKER_REGISTRY: ghcr.io | |
IMAGE_NAME: nmfs-opensci/test-hub-image | |
REPO_DIR: /srv/repo | |
# Lets us monitor disks getting full as images get bigger over time | |
- name: Show how much disk space is left | |
run: df -h |