beb0502fb4
This tags the versions released on Docker Hub so we can rely on those versions rather than the sha.
86 lines
2.3 KiB
YAML
86 lines
2.3 KiB
YAML
name: Build Docker image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
release:
|
|
types:
|
|
- created
|
|
|
|
env:
|
|
DOCKER_IMAGE: archivebox-ci
|
|
|
|
|
|
jobs:
|
|
buildx:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Docker Login
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: true
|
|
fetch-depth: 1
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
- name: Set up Docker Buildx
|
|
id: buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
with:
|
|
version: latest
|
|
install: true
|
|
|
|
- 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@v2
|
|
with:
|
|
path: /tmp/.buildx-cache
|
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
|
restore-keys: |
|
|
${{ runner.os }}-buildx-
|
|
|
|
- name: Get publish tag
|
|
id: publish
|
|
run: |
|
|
if [[ $GITHUB_REF != refs/tags/* ]]; then
|
|
TAG="${GITHUB_REF##*/}"
|
|
else
|
|
TAG=$GITHUB_SHA
|
|
fi
|
|
echo ::set-output name=tag::${TAG}
|
|
env:
|
|
GITHUB_REF: ${{ github.ref }}
|
|
GITHUB_SHA: ${{ github.sha }}
|
|
|
|
- name: Build and push
|
|
id: docker_build
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: ./
|
|
file: ./Dockerfile
|
|
builder: ${{ steps.buildx.outputs.name }}
|
|
push: true
|
|
tags: |
|
|
${{ secrets.DOCKER_USERNAME }}/archivebox:latest
|
|
${{ secrets.DOCKER_USERNAME }}/archivebox:${{ steps.publish.outputs.tag }}
|
|
archivebox/archivebox:latest
|
|
archivebox/archivebox:${{ steps.publish.outputs.tag }}
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
|
|
- name: Image digest
|
|
run: echo ${{ steps.docker_build.outputs.digest }}
|