Skip to content

Commit

Permalink
Update build-containers.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
elreydetoda authored Jan 2, 2025
1 parent 8ba5491 commit bf3de04
Showing 1 changed file with 14 additions and 35 deletions.
49 changes: 14 additions & 35 deletions .github/workflows/build-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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 }}

0 comments on commit bf3de04

Please sign in to comment.