From bf3de0442b60a4ec8dff89b045b7a153ae0603c8 Mon Sep 17 00:00:00 2001 From: elreydetoda <10230166+elreydetoda@users.noreply.github.com> Date: Wed, 1 Jan 2025 23:36:50 -0500 Subject: [PATCH] Update build-containers.yml --- .github/workflows/build-containers.yml | 49 ++++++++------------------ 1 file changed, 14 insertions(+), 35 deletions(-) diff --git a/.github/workflows/build-containers.yml b/.github/workflows/build-containers.yml index 88b04e3..605f572 100644 --- a/.github/workflows/build-containers.yml +++ b/.github/workflows/build-containers.yml @@ -12,18 +12,9 @@ jobs: 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 + - ./ansible|./ansible/Dockerfile|ansible:latest + - ./ansible-playbook|./ansible-playbook/Dockerfile|ansible-playbook:latest + - ./packer-vmware|./packer-vmware/Dockerfile|packer-vmware:latest steps: - name: Checkout repository uses: actions/checkout@v2 @@ -41,31 +32,20 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push ${{ matrix.container.name }} + - name: Build and push ${{ matrix.container }} uses: docker/build-push-action@v2 with: - context: ${{ matrix.container.context }} - file: ${{ matrix.container.dockerfile }} + context: ${{ matrix.container.split('|')[0] }} + file: ${{ matrix.container.split('|')[1] }} push: true - tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.container.tag }} + tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.container.split('|')[2] }} 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 - + ubuntu_version: [20.04, 22.04, 24.04] + steps: - name: Checkout repository uses: actions/checkout@v2 @@ -82,12 +62,11 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push ${{ matrix.container.name }} + - name: Build and push packer-vmware with UBUNTU_VERSION=${{ matrix.ubuntu_version }} uses: docker/build-push-action@v2 with: - context: ${{ matrix.container.context }} - file: ${{ matrix.container.dockerfile }} + context: ./packer-vmware + file: ./packer-vmware/Dockerfile push: true - tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.container.image_name }}:${{ matrix.build_args.version }} - build-args: - - ${{ matrix.build_args.name }}=${{ matrix.build_args.version }} + tags: ghcr.io/${{ github.repository_owner }}/packer-vmware:${{ matrix.ubuntu_version }} + build-args: UBUNTU_VERSION=${{ matrix.ubuntu_version }}