|
| 1 | +name: "Build and push container image" |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "main" |
| 7 | + paths: |
| 8 | + - "docker/*" |
| 9 | + - ".github/workflows/build-and-publish-docker-image.yml" |
| 10 | + |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: "read" |
| 14 | + packages: "write" |
| 15 | + attestations: "write" |
| 16 | + id-token: "write" |
| 17 | + |
| 18 | + |
| 19 | +concurrency: |
| 20 | + group: "${{ github.workflow }}-${{ github.ref }}" |
| 21 | + cancel-in-progress: false |
| 22 | + |
| 23 | + |
| 24 | +jobs: |
| 25 | + build-and-push: |
| 26 | + runs-on: "ubuntu-latest" |
| 27 | + steps: |
| 28 | + |
| 29 | + # For biggish images, github actions runs out of disk space. |
| 30 | + # So we cleanup some unwanted things in the disk image, and reclaim that space for our docker use |
| 31 | + # https://github.com/actions/virtual-environments/issues/2606#issuecomment-772683150 |
| 32 | + # and https://github.com/easimon/maximize-build-space/blob/b4d02c14493a9653fe7af06cc89ca5298071c66e/action.yml#L104 |
| 33 | + # This gives us a total of about 52G of free space, which should be enough for now |
| 34 | + - name: "Cleanup disk space" |
| 35 | + run: | |
| 36 | + sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc |
| 37 | + df -h |
| 38 | +
|
| 39 | + - name: "Checkout files in repo" |
| 40 | + uses: "actions/checkout@v5" |
| 41 | + |
| 42 | + - name: "Build and push the image"` |
| 43 | + uses: "jupyterhub/repo2docker-action@master" |
| 44 | + with: |
| 45 | + REPO2DOCKER_EXTRA_ARGS: "--subdir docker" |
| 46 | + DOCKER_USERNAME: "${{ github.repository_owner }}" |
| 47 | + DOCKER_PASSWORD: "${{ secrets.GITHUB_TOKEN }}" |
| 48 | + DOCKER_REGISTRY: "ghcr.io" |
| 49 | + # Disable pushing a 'latest' tag, as this often just causes confusion |
| 50 | + # LATEST_TAG_OFF: true |
| 51 | + IMAGE_NAME: "geojupyter/workshop-open-source-geospatial" |
| 52 | + # Put repo contents in /srv/repo, so they aren't mangled when we put user home in /home/jovyan |
| 53 | + REPO_DIR: "/srv/repo" |
| 54 | + # Fix man pages that are disabled by Ubuntu 18 minimal base image |
| 55 | + # APPENDIX_FILE: "appendix" |
| 56 | +
|
| 57 | + # Lets us monitor disks getting full as images get bigger over time |
| 58 | + - name: "Show how much disk space is left" |
| 59 | + run: "df -h" |
0 commit comments