Skip to content

Ci health

Ci health #196

Workflow file for this run

name: Docker
on: [push, pull_request, workflow_dispatch]
# adapted from https://raw.githubusercontent.com/stefanprodan/podinfo/master/.github/workflows/release.yml
#
jobs:
containers:
runs-on: ubuntu-latest
env:
PUSH_PACKAGES: ${{ github.repository_owner == 'connormanning' && github.event_name != 'pull_request' }}
steps:
- uses: actions/checkout@v4
- name: Setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
- if: ${{ env.PUSH_PACKAGES == 'true' }}
name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_TOKEN }}
- if: ${{ env.PUSH_PACKAGES == 'true' }}
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
- name: Prepare
id: prep
run: |
VERSION=sha-${GITHUB_SHA::8}
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF/refs\/tags\//}
fi
echo ::set-output name=BUILD_DATE::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
echo ::set-output name=VERSION::${VERSION}
- name: Build image
uses: docker/build-push-action@v6
with:
push: ${{ env.PUSH_PACKAGES == 'true' }}
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./scripts/docker/Dockerfile
platforms: linux/amd64
tags: |
docker.io/connormanning/entwine:${{ steps.prep.outputs.VERSION }}
ghcr.io/connormanning/entwine:${{ steps.prep.outputs.VERSION }}
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.version=${{ steps.prep.outputs.VERSION }}
org.opencontainers.image.created=${{ steps.prep.outputs.BUILD_DATE }}