|
| 1 | +# inspired by |
| 2 | +# https://github.com/thesuperzapper/kubeflow/blob/master/.github/workflows/example_notebook_servers_publish_TEMPLATE.yaml |
| 3 | +name: Build & Publish Notebook Servers (TEMPLATE) |
| 4 | +on: |
| 5 | + workflow_call: |
| 6 | + inputs: |
| 7 | + target: |
| 8 | + required: true |
| 9 | + description: "make target to build" |
| 10 | + type: string |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Login to GitHub Container Registry |
| 19 | + uses: docker/login-action@v3 |
| 20 | + with: |
| 21 | + registry: ghcr.io |
| 22 | + username: ${{ github.actor }} |
| 23 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 24 | + |
| 25 | + # https://github.com/containers/buildah/issues/2521#issuecomment-884779112 |
| 26 | + - name: Workaround https://github.com/containers/podman/issues/22152#issuecomment-2027705598 |
| 27 | + run: sudo apt-get -qq remove podman crun |
| 28 | + |
| 29 | + - uses: actions/cache@v4 |
| 30 | + id: cached-linuxbrew |
| 31 | + with: |
| 32 | + path: /home/linuxbrew/.linuxbrew |
| 33 | + key: linuxbrew |
| 34 | + |
| 35 | + - name: Install podman |
| 36 | + if: steps.cached-linuxbrew.outputs.cache-hit != 'true' |
| 37 | + run: | |
| 38 | + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" |
| 39 | + /home/linuxbrew/.linuxbrew/bin/brew install podman |
| 40 | +
|
| 41 | + - name: Add linuxbrew to PATH |
| 42 | + run: echo "/home/linuxbrew/.linuxbrew/bin/" >> $GITHUB_PATH |
| 43 | + |
| 44 | + - name: Configure Podman |
| 45 | + run: | |
| 46 | + mkdir -p $HOME/.config/containers/ |
| 47 | + cp containers.conf $HOME/.config/containers/containers.conf |
| 48 | + cp storage.conf $HOME/.config/containers/storage.conf |
| 49 | + # should at least reset storage when touching storage.conf |
| 50 | + sudo mkdir -p /mnt/containers/ |
| 51 | + sudo chown -R $USER:$USER /mnt/containers |
| 52 | + podman system reset --force |
| 53 | + # podman bug? need to create this _after_ doing the reset |
| 54 | + mkdir -p /mnt/containers/tmp |
| 55 | +
|
| 56 | + - run: "make ${{ inputs.target }}" |
| 57 | + env: |
| 58 | + IMAGE_REGISTRY: "ghcr.io/${{ github.repository }}/workbench-images" |
| 59 | + CACHE: "ghcr.io/${{ github.repository }}/workbench-images/build-cache" |
| 60 | + |
| 61 | + - run: df -h |
| 62 | + if: "${{ !cancelled() }}" |
0 commit comments