2020-12-06 09:26:44 -05:00
|
|
|
name: Build Docker image
|
2020-11-17 10:57:03 -05:00
|
|
|
|
|
|
|
on:
|
2021-02-01 03:09:31 -05:00
|
|
|
workflow_dispatch:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- '**'
|
|
|
|
tags:
|
|
|
|
- 'v*'
|
|
|
|
# pull_request:
|
2020-11-17 10:57:03 -05:00
|
|
|
|
2020-11-28 05:32:38 -05:00
|
|
|
env:
|
|
|
|
DOCKER_IMAGE: archivebox-ci
|
|
|
|
|
|
|
|
|
2020-11-17 10:57:03 -05:00
|
|
|
jobs:
|
|
|
|
buildx:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2020-11-22 18:41:22 -05:00
|
|
|
- name: Checkout
|
2023-10-31 08:37:26 -04:00
|
|
|
uses: actions/checkout@v4
|
2020-11-28 05:32:38 -05:00
|
|
|
with:
|
2020-11-28 05:48:45 -05:00
|
|
|
submodules: true
|
2020-11-28 05:32:38 -05:00
|
|
|
fetch-depth: 1
|
|
|
|
|
2020-11-22 18:41:22 -05:00
|
|
|
- name: Set up QEMU
|
2023-10-31 08:37:26 -04:00
|
|
|
uses: docker/setup-qemu-action@v3
|
2020-11-28 05:32:38 -05:00
|
|
|
|
2020-11-22 18:41:22 -05:00
|
|
|
- name: Set up Docker Buildx
|
2020-11-17 10:57:03 -05:00
|
|
|
id: buildx
|
2023-10-31 08:37:26 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2020-11-17 10:57:03 -05:00
|
|
|
with:
|
|
|
|
version: latest
|
|
|
|
install: true
|
2023-10-31 09:48:55 -04:00
|
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
2020-11-28 05:32:38 -05:00
|
|
|
|
2020-11-22 18:41:22 -05:00
|
|
|
- name: Builder instance name
|
2020-11-17 10:57:03 -05:00
|
|
|
run: echo ${{ steps.buildx.outputs.name }}
|
2020-11-28 05:32:38 -05:00
|
|
|
|
2020-11-22 18:41:22 -05:00
|
|
|
- name: Available platforms
|
2020-11-17 10:57:03 -05:00
|
|
|
run: echo ${{ steps.buildx.outputs.platforms }}
|
2020-11-28 05:32:38 -05:00
|
|
|
|
2020-11-22 18:41:22 -05:00
|
|
|
- name: Cache Docker layers
|
2023-10-31 08:37:26 -04:00
|
|
|
uses: actions/cache@v3
|
2020-11-17 10:57:03 -05:00
|
|
|
with:
|
|
|
|
path: /tmp/.buildx-cache
|
|
|
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-buildx-
|
2021-01-13 09:07:12 -05:00
|
|
|
|
2021-01-30 01:23:09 -05:00
|
|
|
- name: Docker Login
|
2023-10-31 08:37:26 -04:00
|
|
|
uses: docker/login-action@v3
|
2021-01-30 01:23:09 -05:00
|
|
|
if: github.event_name != 'pull_request'
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
|
|
|
|
- name: Collect Docker tags
|
|
|
|
id: docker_meta
|
2023-10-31 08:37:26 -04:00
|
|
|
uses: docker/metadata-action@v5
|
2021-01-30 01:23:09 -05:00
|
|
|
with:
|
|
|
|
images: archivebox/archivebox,nikisweeting/archivebox
|
2021-04-05 15:48:30 -04:00
|
|
|
flavor: |
|
2021-04-05 17:10:19 -04:00
|
|
|
latest=auto
|
2021-04-05 15:48:30 -04:00
|
|
|
tags: |
|
|
|
|
type=ref,event=branch
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
type=sha
|
2021-01-10 17:08:00 -05:00
|
|
|
|
2020-11-22 18:41:22 -05:00
|
|
|
- name: Build and push
|
2020-11-17 10:57:03 -05:00
|
|
|
id: docker_build
|
2023-10-31 08:37:26 -04:00
|
|
|
uses: docker/build-push-action@v5
|
2020-11-17 10:57:03 -05:00
|
|
|
with:
|
|
|
|
context: ./
|
|
|
|
file: ./Dockerfile
|
|
|
|
builder: ${{ steps.buildx.outputs.name }}
|
2021-01-30 01:23:09 -05:00
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
|
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
2020-11-17 10:57:03 -05:00
|
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
|
|
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
2021-02-01 06:05:12 -05:00
|
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
2021-01-10 17:08:00 -05:00
|
|
|
|
2020-11-22 18:41:22 -05:00
|
|
|
- name: Image digest
|
2020-11-17 10:57:03 -05:00
|
|
|
run: echo ${{ steps.docker_build.outputs.digest }}
|