diff --git a/.github/workflows/build-containers.yml b/.github/workflows/build-containers.yml index 34902c5..88b04e3 100644 --- a/.github/workflows/build-containers.yml +++ b/.github/workflows/build-containers.yml @@ -9,6 +9,21 @@ on: jobs: build: runs-on: ubuntu-latest + strategy: + matrix: + container: + - name: ansible + context: ./ansible + dockerfile: ./ansible/Dockerfile + tag: ansible:latest + - name: ansible-playbook + context: ./ansible-playbook + dockerfile: ./ansible-playbook/Dockerfile + tag: ansible-playbook:latest + - name: packer-vmware + context: ./packer-vmware + dockerfile: ./packer-vmware/Dockerfile + tag: packer-vmware:latest steps: - name: Checkout repository uses: actions/checkout@v2 @@ -26,27 +41,53 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push ansible + - name: Build and push ${{ matrix.container.name }} uses: docker/build-push-action@v2 with: - context: ./ansible - file: ./ansible/Dockerfile - # platforms: linux/amd64 + context: ${{ matrix.container.context }} + file: ${{ matrix.container.dockerfile }} push: true - tags: ghcr.io/${{ github.repository_owner }}/ansible:latest - - name: Build and push - uses: docker/build-push-action@v2 + tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.container.tag }} + + build-packer-vmware: + runs-on: ubuntu-latest + strategy: + matrix: + container: + - name: packer-vmware + context: ./packer-vmware + dockerfile: ./packer-vmware/Dockerfile + image_name: packer-vmware + build_args: + - name: UBUNTU_VERSION + version: 20.04 + - name: UBUNTU_VERSION + version: 22.04 + - name: UBUNTU_VERSION + version: 24.04 + + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 with: - context: ./ansible-playbook - file: ./ansible-playbook/Dockerfile - # platforms: linux/amd64 - push: true - tags: ghcr.io/${{ github.repository_owner }}/ansible-playbook:latest - - name: Build and push ansible + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push ${{ matrix.container.name }} uses: docker/build-push-action@v2 with: - context: ./packer-vmware - file: ./packer-vmware/Dockerfile - # platforms: linux/amd64 + context: ${{ matrix.container.context }} + file: ${{ matrix.container.dockerfile }} push: true - tags: ghcr.io/${{ github.repository_owner }}/packer-vmware:latest + tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.container.image_name }}:${{ matrix.build_args.version }} + build-args: + - ${{ matrix.build_args.name }}=${{ matrix.build_args.version }} diff --git a/packer-vmware/Dockerfile b/packer-vmware/Dockerfile index 9281505..25bae9b 100644 --- a/packer-vmware/Dockerfile +++ b/packer-vmware/Dockerfile @@ -1,6 +1,7 @@ ARG PACKER_VERSION=1.11.2 +ARG UBUNTU_VERSION=24.04 FROM "docker.io/hashicorp/packer:light-${PACKER_VERSION}" as packer_bin -FROM docker.io/ubuntu:24.04 +FROM docker.io/ubuntu:${UBUNTU_VERSION} SHELL ["/bin/bash", "-euxc"] COPY --from=packer_bin /bin/packer /usr/local/bin/packer RUN set -o pipefail \