Open5

go-ipfs の ARM な Docker イメージを作成する

odanodan

とりあえず作った
https://github.com/odanado/go-ipfs-docker

workflow_dispatch の input でタグを受け取る感じ

name: build

on:
  push:
    branches: [ main ]
  pull_request:
  workflow_dispatch:
    inputs:
      tag:
        description: 'tag of go-ipfs'
        required: true

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Get ref
        id: ref
        run: |
          REF="${{ github.event.inputs.tag }}"
          echo "::set-output name=value::$(echo ${REF:-master})"
        shell: bash
      - name: Get tag
        id: tag
        run: |
          REF="${{ github.event.inputs.tag }}"
          echo "::set-output name=value::$(echo ${REF:-latest})"
        shell: bash

      - uses: actions/checkout@v2
        with:
          repository: ipfs/go-ipfs
          path: go-ipfs
          ref: "${{ steps.ref.outputs.value }}"
          
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v1

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1
        
      - name: Login to DockerHub
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
        
      - name: Build and push
        uses: docker/build-push-action@v2
        with:
          platforms: linux/amd64,linux/arm64
          context: ./go-ipfs
          file: ./go-ipfs/Dockerfile
          pull: true
          push: true
          cache-from: type=registry,ref=settlemint/go-ipfs:latest
          cache-to: type=inline
          tags: |
            "odanado/go-ipfs:${{ steps.tag.outputs.value }}"
odanodan

タグを取得したい

https://github.com/ipfs/go-ipfsgit clone して git tag | grep v を実行すればタグ一覧は手に入る

cat ~/tags.txt | xargs -I{} gh workflow run build.yml -F tag={} で全てのタグに対して build を開始できる

odanodan

GitHub Actions にめっちゃ負荷をかけた気がするけどできた