Skip to content

Merge pull request #17 from quiknode-labs/renovate/docker-setup-build… #57

Merge pull request #17 from quiknode-labs/renovate/docker-setup-build…

Merge pull request #17 from quiknode-labs/renovate/docker-setup-build… #57

Workflow file for this run

name: docker-image
on:
push:
branches:
- main
tags:
- '*.*.*'
schedule:
- cron: '0 1 * * 0'
env:
IMAGE_NAME: ghcr.io/quiknode-labs/docker-ansible-core
LATEST_OS: alpine
LATEST_VERSION: v2.16
DOCKER_CLI_VERSION: "27.1.2"
GOSU_VERSION: "1.14"
jobs:
build_push_before_python38:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
strategy:
matrix:
os: [almalinux8, alpine, ubuntu]
version: [v2.11]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare
id: prep
run: |
cp requirements/${MATRIX_VERSION}/requirements.txt requirements/requirements.txt
TAGS="${IMAGE_NAME}:${MATRIX_VERSION}-${MATRIX_OS}"
# Conditional logic for additional tags
if [[ "$MATRIX_OS" == "$LATEST_OS" ]]; then
TAGS="${TAGS},${IMAGE_NAME}:${MATRIX_VERSION}"
elif [[ "$MATRIX_OS" == "almalinux8" && "$MATRIX_VERSION" == "v2.11" ]]; then
TAGS="${TAGS},${IMAGE_NAME}:latest-${MATRIX_OS}"
fi
echo "::set-output name=tags::${TAGS}"
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
env:
MATRIX_OS: ${{ matrix.os }}
MATRIX_VERSION: ${{ matrix.version }}
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build and Push
uses: docker/build-push-action@v6
with:
labels: |
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.source=${{ github.repositoryUrl }}
org.opencontainers.image.version=${{ matrix.version }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.licenses=${{ github.event.repository.license.name }}
build-args: |
docker_version=${{ env.DOCKER_CLI_VERSION }}
gosu_version=${{ env.GOSU_VERSION }}
context: .
file: ./Dockerfile.${{ matrix.os }}
tags: ${{ steps.prep.outputs.tags }}
push: true
build_push_python38_and_later:
needs: build_push_before_python38
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
strategy:
matrix:
os: [alpine, ubuntu]
version: [v2.12, v2.13,v2.15, v2.16]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare
id: prep
run: |
cp requirements/${MATRIX_VERSION}/requirements.txt requirements/requirements.txt
TAGS="${IMAGE_NAME}:${MATRIX_VERSION}-${MATRIX_OS}"
if [[ "$MATRIX_OS" == "$LATEST_OS" ]]; then
TAGS="${TAGS},${IMAGE_NAME}:$MATRIX_VERSION"
if [[ "$MATRIX_VERSION" == "$LATEST_VERSION" ]]; then
TAGS="${TAGS},${IMAGE_NAME}:latest-${MATRIX_OS},${IMAGE_NAME}:latest"
fi
elif [[ "$MATRIX_VERSION" == "$LATEST_VERSION" ]]; then
TAGS="${TAGS},${IMAGE_NAME}:latest-${MATRIX_OS}"
fi
echo "::set-output name=tags::${TAGS}"
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
env:
MATRIX_OS: ${{ matrix.os }}
MATRIX_VERSION: ${{ matrix.version }}
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build and Push
uses: docker/build-push-action@v6
with:
labels: |
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.source=${{ github.repositoryUrl }}
org.opencontainers.image.version=${{ matrix.version }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.licenses=${{ github.event.repository.license.name }}
build-args: |
docker_version=${{ env.DOCKER_CLI_VERSION }}
gosu_version=${{ env.GOSU_VERSION }}
context: .
file: ./Dockerfile.${{ matrix.os }}
tags: ${{ steps.prep.outputs.tags }}
push: true