How to build mybinder image automatically at each commit

I have a Julia-based repository that uses some notebooks, with the documentation pointing to their mybinder/ instance.

The problem is that the first user that clicks on them after a commit will have to wait a while.
I am hence trying to automatise the building of the mybinder image.

I set the following on .github/workflow/binder.yaml:

name: Binder
on: [push]

jobs:
  Create-Binder-Badge:
    runs-on: ubuntu-latest
    steps:
    - name: cache binder build on mybinder.org
      uses: machine-learning-apps/repo2docker-action@0.2
      with:
        NO_PUSH: true
        MYBINDERORG_TAG: ${{ github.event.ref }} # This builds the container on mybinder.org with the branch that was pushed on.

However at each commit I receive the following “run failed” error:

image


https://github.com/sylvaticus/BetaML.jl/runs/902873331#step:3:35 : jupyter-repo2docker: error: argument --image-name: 'sylvaticus/BetaML.jl:cde0f752c685' is not a valid docker image name. Image namemust start with an alphanumeric character andcan then use _ . or - in addition to alphanumeric.

The image name is invalid, as shown by trying docker tag locally:

$ docker tag busybox sylvaticus/BetaML.jl:cde0f752c685

Error parsing reference: "sylvaticus/BetaML.jl:cde0f752c685" is not a valid repository/tag: invalid reference format: repository name must be lowercase
Error parsing reference: "sylvaticus/BetaML.jl:cde0f752c685" is not a valid repository/tag: invalid reference format: repository name must be lowercase

You could try overriding the image name using IMAGE_NAME:

1 Like

Thank you.
I can confirm that this indeed works:

name: Binder
on: push

jobs:
  Create-MyBinderOrg-Cache:
    runs-on: ubuntu-latest
    steps:
    - name: cache binder build on mybinder.org
      uses: jupyterhub/repo2docker-action@master
      with:
        NO_PUSH: true
        MYBINDERORG_TAG: ${{ github.event.ref }} # This builds the container on mybinder.org with the branch that was pushed on.
        IMAGE_NAME: sylvaticus/betaml

If I understood it clearly, maybe the script on https://github.com/jupyterhub/repo2docker-action/blob/c62a8dd43e7fdfc9d1bb719da9901dec2afc4b81/trigger_binder.sh would benefit of a lowercase() function to account for repositories with upper case names ?

@hamel What do you think? Are there any other forbidden Docker characters than are allowed in GitHub repository names?

I believe it that is a restriction that repo2docker has and isn’t specific to the GitHub Action. Might be worth asking in that repo?

Edit: sorry I misread! Yes there could be GitHub vs Docker name collision

Is lowercase the only issue in this case? Do you want to make a PR or should I fix it?

Here’s my attempt! https://github.com/jupyterhub/repo2docker-action/pull/44

3 Likes

:rocket: Merged :rocket: Great Job

1 Like