Skip to content

Merge pull request #137 from acim/dependabot/github_actions/docker/bu… #298

Merge pull request #137 from acim/dependabot/github_actions/docker/bu…

Merge pull request #137 from acim/dependabot/github_actions/docker/bu… #298

Workflow file for this run

name: build
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4
- name: Lint Dockerfile
uses: hadolint/[email protected]
with:
dockerfile: Dockerfile
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/[email protected]
- name: Inspect builder
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
- name: Login to container registry
uses: docker/[email protected]
with:
username: ${{ github.actor }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Prepare tags
id: prep
run: |
IMAGE=acim/go-reflex
VERSION=$(grep FROM Dockerfile | awk '{ print $2 }' | cut -d ':' -f 2)
TAGS="${IMAGE}:${VERSION},${IMAGE}:${GITHUB_SHA::8},${IMAGE}:latest"
echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- name: Build and push image to container registry
uses: docker/[email protected]
with:
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.prep.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
labels: |
org.opencontainers.image.title=go-reflex
org.opencontainers.image.description='Docker image for autorecompiling and autorestarting Golang server'
org.opencontainers.image.url=https://github.com/acim/go-reflex
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.version=${{ steps.prep.outputs.version }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }}
org.opencontainers.image.vendor=ectobit.com