Skip to content

Merge pull request #160 from philips-labs/dependabot/docker/golang-1.… #160

Merge pull request #160 from philips-labs/dependabot/docker/golang-1.…

Merge pull request #160 from philips-labs/dependabot/docker/golang-1.… #160

Workflow file for this run

name: docker
on:
push:
branches: ["main"]
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Calculate Docker image tags
id: tags
env:
DOCKER_IMAGES: "ghcr.io/philips-labs/siderite"
run: |
case $GITHUB_REF in
refs/tags/*) VERSION=${GITHUB_REF#refs/tags/};;
refs/heads/*) VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g');;
refs/pull/*) VERSION=pr-${{ github.event.number }};;
*) VERSION=sha-${GITHUB_SHA::8};;
esac
TAGS=()
for image in $DOCKER_IMAGES; do
TAGS+=("${image}:${VERSION}")
if [[ "${{ github.event.repository.default_branch }}" == "$VERSION" ]]; then
TAGS+=("${image}:latest")
fi
done
echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::$(IFS=,; echo "${TAGS[*]}")
echo ::set-output name=commit_hash::${GITHUB_SHA::8}
echo ::set-output name=build_date::$(git show -s --format=%cI)
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
install: true
version: latest
# TODO: Remove driver-opts once fix is released docker/buildx#386
driver-opts: image=moby/buildkit:master
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
if: github.event_name == 'push'
- name: Git information
id: vars
shell: bash
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
-
name: Build and push alpine
id: docker_build
uses: docker/build-push-action@v5
with:
context: ./
file: ./Dockerfile
build-args: |
GIT_COMMIT=${{ steps.vars.outputs.sha_short }}
platforms: linux/amd64
push: true
tags: ${{ steps.tags.outputs.tags }}
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
-
name: Build and push debian
id: docker_build_debian
uses: docker/build-push-action@v5
with:
context: ./
file: ./Dockerfile.debian
build-args: |
GIT_COMMIT=${{ steps.vars.outputs.sha_short }}
platforms: linux/amd64
push: true
tags: ${{ steps.tags.outputs.tags }}-debian
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}