Skip to content

add debugging

add debugging #82

Workflow file for this run

---
name: build.docker
on:
pull_request:
branches:
- main
push:
branches:
- main
tags:
- 'v*.*.*'
workflow_dispatch:
env:
REGISTRY_IMAGE: ghcr.io/${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci-skip]')"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Prepare
id: prep
run: |
VERSION=dev
if [[ $GITHUB_REF == refs/tags/v* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
fi
# v1.0.0
TAGS="${REGISTRY_IMAGE}:${VERSION}"
# v1.0.0,v1
TAGS="${TAGS},${REGISTRY_IMAGE}:${VERSION%%.*}"
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
# :v1.0.0,:v1,:latest
TAGS="${TAGS},${REGISTRY_IMAGE}:latest"
fi
echo ::set-output name=tags::${TAGS}
if [ "${{github.event_name}}" == "pull_request" ]; then
echo ::set-output name=push::false
echo ::set-output name=cache_from::"type=registry,ref=${REGISTRY_IMAGE}:buildcache"
echo ::set-output name=cache_to::""
else
echo ::set-output name=push::true
echo ::set-output name=cache_from::"type=registry,ref=${REGISTRY_IMAGE}:buildcache"
echo ::set-output name=cache_to::"type=registry,ref=${REGISTRY_IMAGE}:buildcache,mode=max"
fi
echo ::set-output name=github_server_url::"${GITHUB_SERVER_URL}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: amd64,arm64
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
with:
install: true
version: latest
driver-opts: image=moby/buildkit:v0.10.4
- name: Log in to the Container registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
id: docker_build
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ steps.prep.outputs.push }}
tags: ${{ steps.prep.outputs.tags }}
build-args: |
IMAGE_SOURCE=${{ steps.prep.outputs.github_server_url }}/${{ github.repository }}
cache-from: ${{ steps.prep.outputs.cache_from }}
cache-to: ${{ steps.prep.outputs.cache_to }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}