| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- name: Build Docker image
- on:
- workflow_dispatch:
- push:
- branches:
- - '**'
- tags:
- - 'v*'
- # pull_request:
- env:
- DOCKER_IMAGE: archivebox-ci
- jobs:
- buildx:
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- with:
- submodules: true
- fetch-depth: 1
- - name: Set up QEMU
- uses: docker/setup-qemu-action@v3
- - name: Set up Docker Buildx
- id: buildx
- uses: docker/setup-buildx-action@v3
- with:
- version: latest
- install: true
- platforms: linux/amd64,linux/arm64
- - name: Builder instance name
- run: echo ${{ steps.buildx.outputs.name }}
- - name: Available platforms
- run: echo ${{ steps.buildx.outputs.platforms }}
- - name: Cache Docker layers
- uses: actions/cache@v3
- with:
- path: /tmp/.buildx-cache
- key: ${{ runner.os }}-buildx-${{ github.sha }}
- restore-keys: |
- ${{ runner.os }}-buildx-
- - name: Docker Login
- uses: docker/login-action@v3
- if: github.event_name != 'pull_request'
- with:
- username: ${{ secrets.DOCKER_USERNAME }}
- password: ${{ secrets.DOCKER_PASSWORD }}
- - name: Collect Docker tags
- # https://github.com/docker/metadata-action
- id: docker_meta
- uses: docker/metadata-action@v5
- with:
- images: archivebox/archivebox,nikisweeting/archivebox
- tags: |
- # :stable
- type=ref,event=branch
- # :0.7.3
- type=semver,pattern={{version}}
- # :0.7
- type=semver,pattern={{major}}.{{minor}}
- # :sha-463ea54
- type=sha
- # :latest
- type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'stable') }}
- - name: Build and push
- id: docker_build
- uses: docker/build-push-action@v5
- with:
- context: ./
- file: ./Dockerfile
- builder: ${{ steps.buildx.outputs.name }}
- push: ${{ github.event_name != 'pull_request' }}
- tags: ${{ steps.docker_meta.outputs.tags }}
- labels: ${{ steps.docker_meta.outputs.labels }}
- cache-from: type=local,src=/tmp/.buildx-cache
- cache-to: type=local,dest=/tmp/.buildx-cache-new
- platforms: linux/amd64,linux/arm64
- - name: Image digest
- run: echo ${{ steps.docker_build.outputs.digest }}
- - name: Update README
- uses: peter-evans/dockerhub-description@v4
- with:
- username: ${{ secrets.DOCKER_USERNAME }}
- password: ${{ secrets.DOCKER_PASSWORD }}
- repository: archivebox/archivebox
- # This ugly bit is necessary if you don't want your cache to grow forever
- # until it hits GitHub's limit of 5GB.
- # Temp fix
- # https://github.com/docker/build-push-action/issues/252
- # https://github.com/moby/buildkit/issues/1896
- - name: Move cache
- run: |
- rm -rf /tmp/.buildx-cache
- mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|