Skip to content

Molecule Build Images #8

Molecule Build Images

Molecule Build Images #8

---
name: Molecule Build Images
on:
workflow_dispatch:
jobs:
hadolint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 3
matrix:
OS_VERSION: [opensuse15.5, opensuse15.6, centos8, centos9, debian10, debian11, debian12, ubuntu20.04, ubuntu22.04, ubuntu24.04]
env:
PY_COLORS: 1
ANSIBLE_FORCE_COLOR: 1
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Linting Dockerfile from List
uses: hadolint/[email protected]
env:
DOCKERFILE_PROFILE: ${{ matrix.OS_VERSION }}
with:
recursive: true
dockerfile: ./dockerfiles/${{ env.DOCKERFILE_PROFILE }}.dockerfile
ignore: "DL3008,DL3013,DL3033,DL3037,DL3041"
build-suse-image:
needs: hadolint
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
build-suse-image-matrix:
needs: build-suse-image
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 3
matrix:
OS_VERSION: [opensuse15.5, opensuse15.6]
env:
PY_COLORS: 1
ANSIBLE_FORCE_COLOR: 1
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
env:
DOCKER_HUB_USER: "mdd13"
DOCKER_HUB_REPOSITORY: "ansible-docker-suse"
IMAGE_TAG: ${{ matrix.OS_VERSION }}
with:
push: true
context: ./dockerfiles/
tags: ${{ env.DOCKER_HUB_USER }}/${{ env.DOCKER_HUB_REPOSITORY }}:${{ env.IMAGE_TAG }}
file: ./dockerfiles/${{ env.IMAGE_TAG }}.dockerfile
cache-from: type=gha,ref=${{ env.DOCKER_HUB_USER }}/${{ env.DOCKER_HUB_REPOSITORY }}:${{ env.IMAGE_TAG }}
cache-to: type=gha,ref=${{ env.DOCKER_HUB_USER }}/${{ env.DOCKER_HUB_REPOSITORY }}:${{ env.IMAGE_TAG }},mode=max
build-redhat-image:
needs: hadolint
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
build-redhat-image-matrix:
needs: build-redhat-image
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 3
matrix:
OS_VERSION: [centos8, centos9]
env:
PY_COLORS: 1
ANSIBLE_FORCE_COLOR: 1
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
env:
DOCKER_HUB_USER: "mdd13"
DOCKER_HUB_REPOSITORY: "ansible-docker-redhat"
IMAGE_TAG: ${{ matrix.OS_VERSION }}
with:
push: true
context: ./dockerfiles/
tags: ${{ env.DOCKER_HUB_USER }}/${{ env.DOCKER_HUB_REPOSITORY }}:${{ env.IMAGE_TAG }}
file: ./dockerfiles/${{ env.IMAGE_TAG }}.dockerfile
cache-from: type=gha,ref=${{ env.DOCKER_HUB_USER }}/${{ env.DOCKER_HUB_REPOSITORY }}:${{ env.IMAGE_TAG }}
cache-to: type=gha,ref=${{ env.DOCKER_HUB_USER }}/${{ env.DOCKER_HUB_REPOSITORY }}:${{ env.IMAGE_TAG }},mode=max
build-debian-image:
needs: hadolint
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
build-debian-image-matrix:
needs: build-debian-image
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 3
matrix:
OS_VERSION: [debian10, debian11, debian12]
env:
PY_COLORS: 1
ANSIBLE_FORCE_COLOR: 1
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
env:
DOCKER_HUB_USER: "mdd13"
DOCKER_HUB_REPOSITORY: "ansible-docker-debian"
IMAGE_TAG: ${{ matrix.OS_VERSION }}
with:
push: true
context: ./dockerfiles/
tags: ${{ env.DOCKER_HUB_USER }}/${{ env.DOCKER_HUB_REPOSITORY }}:${{ env.IMAGE_TAG }}
file: ./dockerfiles/${{ env.IMAGE_TAG }}.dockerfile
cache-from: type=gha,ref=${{ env.DOCKER_HUB_USER }}/${{ env.DOCKER_HUB_REPOSITORY }}:${{ env.IMAGE_TAG }}
cache-to: type=gha,ref=${{ env.DOCKER_HUB_USER }}/${{ env.DOCKER_HUB_REPOSITORY }}:${{ env.IMAGE_TAG }},mode=max
build-ubuntu-image:
needs: hadolint
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
build-ubuntu-image-matrix:
needs: build-ubuntu-image
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 3
matrix:
OS_VERSION: [ubuntu20.04, ubuntu22.04, ubuntu24.04]
env:
PY_COLORS: 1
ANSIBLE_FORCE_COLOR: 1
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
env:
DOCKER_HUB_USER: "mdd13"
DOCKER_HUB_REPOSITORY: "ansible-docker-ubuntu"
IMAGE_TAG: ${{ matrix.OS_VERSION }}
with:
push: true
context: ./dockerfiles/
tags: ${{ env.DOCKER_HUB_USER }}/${{ env.DOCKER_HUB_REPOSITORY }}:${{ env.IMAGE_TAG }}
file: ./dockerfiles/${{ env.IMAGE_TAG }}.dockerfile
cache-from: type=gha,ref=${{ env.DOCKER_HUB_USER }}/${{ env.DOCKER_HUB_REPOSITORY }}:${{ env.IMAGE_TAG }}
cache-to: type=gha,ref=${{ env.DOCKER_HUB_USER }}/${{ env.DOCKER_HUB_REPOSITORY }}:${{ env.IMAGE_TAG }},mode=max