|
| 1 | +name: Docker CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: ['main'] |
| 6 | + paths: ['Dockerfile','.github/workflows/ci-docker.yml'] |
| 7 | + |
| 8 | +env: |
| 9 | + REGISTRY: ghcr.io |
| 10 | + IMAGE_NAME: blinklabs/haskell |
| 11 | + |
| 12 | +jobs: |
| 13 | + build-amd64: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v2 |
| 17 | + - name: qemu |
| 18 | + uses: docker/setup-qemu-action@v2 |
| 19 | + - uses: docker/setup-buildx-action@v2 |
| 20 | + - uses: actions/cache@v3 |
| 21 | + with: |
| 22 | + path: /tmp/.buildx-cache |
| 23 | + key: ${{ runner.os }}-${{ runner.arch }}-buildx-${{ github.sha }} |
| 24 | + restore-keys: | |
| 25 | + ${{ runner.os }}-${{ runner.arch }}-buildx- |
| 26 | + - id: meta |
| 27 | + uses: docker/metadata-action@v4 |
| 28 | + with: |
| 29 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 30 | + flavor: | |
| 31 | + latest=false |
| 32 | + suffix=-amd64 |
| 33 | + - name: build |
| 34 | + uses: docker/build-push-action@v3 |
| 35 | + with: |
| 36 | + context: . |
| 37 | + push: false |
| 38 | + tags: ${{ steps.meta.outputs.tags }} |
| 39 | + labels: ${{ steps.meta.outputs.labels }} |
| 40 | + cache-from: type=local,src=/tmp/.buildx-cache |
| 41 | + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max |
| 42 | + # TEMP fix |
| 43 | + # https://github.com/docker/build-push-action/issues/252 |
| 44 | + # https://github.com/moby/buildkit/issues/1896 |
| 45 | + - name: cache |
| 46 | + run: | |
| 47 | + rm -rf /tmp/.buildx-cache |
| 48 | + mv /tmp/.buildx-cache-new /tmp/.buildx-cache |
| 49 | +
|
| 50 | + build-arm64: |
| 51 | + runs-on: self-hosted |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@v2 |
| 54 | + - name: qemu |
| 55 | + uses: docker/setup-qemu-action@v2 |
| 56 | + - uses: docker/setup-buildx-action@v2 |
| 57 | + - uses: actions/cache@v3 |
| 58 | + with: |
| 59 | + path: /tmp/.buildx-cache |
| 60 | + key: ${{ runner.os }}-${{ runner.arch }}-buildx-${{ github.sha }} |
| 61 | + restore-keys: | |
| 62 | + ${{ runner.os }}-${{ runner.arch }}-buildx- |
| 63 | + - id: meta |
| 64 | + uses: docker/metadata-action@v4 |
| 65 | + with: |
| 66 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 67 | + flavor: | |
| 68 | + latest=false |
| 69 | + suffix=-arm64v8 |
| 70 | + - name: build |
| 71 | + uses: docker/build-push-action@v3 |
| 72 | + with: |
| 73 | + context: . |
| 74 | + push: false |
| 75 | + tags: ${{ steps.meta.outputs.tags }} |
| 76 | + labels: ${{ steps.meta.outputs.labels }} |
| 77 | + cache-from: type=local,src=/tmp/.buildx-cache |
| 78 | + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max |
| 79 | + # TEMP fix |
| 80 | + # https://github.com/docker/build-push-action/issues/252 |
| 81 | + # https://github.com/moby/buildkit/issues/1896 |
| 82 | + - name: cache |
| 83 | + run: | |
| 84 | + rm -rf /tmp/.buildx-cache |
| 85 | + mv /tmp/.buildx-cache-new /tmp/.buildx-cache |
0 commit comments