Skip to content

Rewrite Dockerfile to use python:3.12 and update to latest ansible (9.6.0) #638

Rewrite Dockerfile to use python:3.12 and update to latest ansible (9.6.0)

Rewrite Dockerfile to use python:3.12 and update to latest ansible (9.6.0) #638

Workflow file for this run

name: Build and push docker images
on:
push:
branches:
- 'main'
paths-ignore:
- 'ReadMe.md'
- 'LICENSE.md'
- 'scripts'
pull_request:
branches:
- 'main'
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Detect ansible version from requirements.txt
run: echo "::set-output name=ANSIBLE_VERSION::$(grep -oP 'ansible==\K(.*)' requirements.txt)"
id: ansible-version
- name: use a custom tag when on main branch
if: github.ref == 'refs/heads/main'
id: custom-tag-main-branch
run: echo "::set-output name=CUSTOM_TAG::gableroux/ansible:${{ steps.ansible-version.outputs.ANSIBLE_VERSION }}"
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: |
gableroux/ansible
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch,prefix=${{ steps.ansible-version.outputs.ANSIBLE_VERSION }}-branch-
type=ref,event=pr,prefix=${{ steps.ansible-version.outputs.ANSIBLE_VERSION }}-pr-
type=semver,pattern={{version}},prefix=${{ steps.ansible-version.outputs.ANSIBLE_VERSION }}-
type=sha,prefix=${{ steps.ansible-version.outputs.ANSIBLE_VERSION }}-sha-
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ steps.meta.outputs.tags }}
${{ steps.custom-tag-main-branch.outputs.CUSTOM_TAG }}
labels: ${{ steps.meta.outputs.labels }}