Skip to content

Update README.md to trigger workflow #12

Update README.md to trigger workflow

Update README.md to trigger workflow #12

Workflow file for this run

name: Build and push container images
# Trigger this workflow on pushes to main branches under the images folder or
# in PRs to the main branch that change the image folder
on:
push:
branches:
- main
paths:
- "images/**"
# When multiple PRs triggering this workflow are merged, queue them instead
# of running them in parallel in case of clashes when pushing
# https://github.blog/changelog/2021-04-19-github-actions-limit-workflow-run-or-job-concurrency/
concurrency: image-build
jobs:
# This job establishes from filepaths changed which images will be built by the
# next job
generate-build-matrix:
runs-on: ubuntu-latest
outputs:
images-to-build: ${{ env.images-to-build }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install script requirements
run: python -m pip install -r scripts/requirements.txt
- name: Identify files that have been added or modified
# Action repo: https://github.com/dorny/paths-filter
# Fork of the repo above that we use: https://github.com/frouioui/paths-filter/tree/main
# In order to take advantage of https://github.com/dorny/paths-filter/pull/133
uses: frouioui/paths-filter@main
id: changed-files
with:
token: ""
list-files: csv
filters: |
changed:
- added|modified: images/**
- name: Generate matrix jobs
run: |
python scripts/generate-image-build-matrix-jobs.py "${{ steps.changed-files.outputs.changed_files }}"
# This job will build the images identified by the previous job and optionally
# push them to container registry
build-and-push:
runs-on: ubuntu-latest
needs: [generate-build-matrix]
strategy:
matrix:
jobs: ${{ fromJson(needs.generate-build-matrix.outputs.images-to-build) }}
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 repo
uses: actions/checkout@v4
- name: Build and conditionally push the image to quay.io
uses: jupyterhub/repo2docker-action@master
with:
# Make sure username & password/token pair matches your registry credentials
DOCKER_USERNAME: ${{ secrets.QUAY_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
DOCKER_REGISTRY: "quay.io"
# Disable pushing a 'latest' tag, as this often just causes confusion
LATEST_TAG_OFF: true
# NOTE: This line assumes that the subfolder that contains the image has
# the same name as the image when it is pushed to the registry. We
# can update the logic here later if needed.
IMAGE_NAME: "2i2c/${{ matrix.jobs.image-name }}"
# Tell repo2docker which subdirectory to examine
# ref: https://repo2docker.readthedocs.io/en/latest/usage.html#cmdoption-jupyter-repo2docker-subdir
REPO2DOCKER_EXTRA_ARGS: "--subdir images/${{ matrix.jobs.image-name }}"
# Lets us monitor disks getting full as images get bigger over time
- name: Show how much disk space is left
run: df -h