Building container - CentOS #139
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build container - centos | |
run-name: Building container - CentOS | |
on: | |
workflow_dispatch: | |
jobs: | |
build-arm64: | |
name: build-container-centos-arm64 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-24.04-arm | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Run podman build - centos-arm | |
run: | | |
podman build -t ghcr.io/gbraad-dotfiles/centos:arm64 \ | |
--build-arg=BASE_IMAGE="quay.io/centos/centos" \ | |
--build-arg=BASE_VERSION="stream9" \ | |
--build-arg=ARCH="aarch64" \ | |
-f .devcontainer/centos/Containerfile . | |
- name: Run podman save - centos-arm | |
run: | | |
podman save ghcr.io/gbraad-dotfiles/centos:arm64 \ | |
--format=oci-dir -o oci-arm64 | |
- name: Run podman export - centos-arm | |
run: | | |
podman create --name centos-arm64 \ | |
ghcr.io/gbraad-dotfiles/centos:arm64 | |
podman export centos-arm64 -o centos-arm64.tar | |
gzip centos-arm64.tar | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: oci-arm64 | |
path: oci-arm64/ | |
retention-days: 7 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: rootfs-arm64 | |
path: centos-arm64.tar.gz | |
retention-days: 7 | |
build-amd64: | |
name: build-container-centos-amd64 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Run podman build - centos | |
run: | | |
podman build -t ghcr.io/gbraad-dotfiles/centos:amd64 \ | |
--build-arg=BASE_IMAGE="quay.io/centos/centos" \ | |
--build-arg=BASE_VERSION="stream9" \ | |
-f .devcontainer/centos/Containerfile . | |
- name: Run podman save - centos | |
run: | | |
podman save ghcr.io/gbraad-dotfiles/centos:amd64 \ | |
--format=oci-dir -o oci-amd64 | |
- name: Run podman export - centos | |
run: | | |
podman create --name centos-amd64 \ | |
ghcr.io/gbraad-dotfiles/centos:amd64 | |
podman export centos-amd64 -o centos-amd64.tar | |
gzip centos-amd64.tar | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: oci-amd64 | |
path: oci-amd64/ | |
retention-days: 7 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: rootfs-amd64 | |
path: centos-amd64.tar.gz | |
retention-days: 7 | |
push-manifest: | |
name: build-container-centos | |
needs: | |
- build-arm64 | |
- build-amd64 | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Download arm64 | |
uses: actions/download-artifact@v4 | |
with: | |
name: oci-arm64 | |
path: oci-arm64 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: rootfs-arm64 | |
path: rootfs | |
- name: Download amd64 | |
uses: actions/download-artifact@v4 | |
with: | |
name: oci-amd64 | |
path: oci-amd64 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: rootfs-amd64 | |
path: rootfs | |
- name: Set release tag | |
id: get-tag | |
run: | | |
echo "TAG=$(date +'%y%m%d')" >> $GITHUB_OUTPUT | |
- name: Create manifest | |
run: | | |
podman manifest create centos-manifest | |
- name: Add arm64 to manifest | |
run: | | |
podman manifest add centos-manifest oci:$(pwd)/oci-arm64 | |
- name: Add amd64 to manifest | |
run: | | |
podman manifest add centos-manifest oci:$(pwd)/oci-amd64 | |
- name: Login to registry | |
run: | | |
podman login ghcr.io -u ${{ github.actor }} \ | |
-p ${{ secrets.GITHUB_TOKEN }} | |
- name: Push container to registry | |
run: | | |
podman manifest push centos-manifest docker://ghcr.io/gbraad-dotfiles/centos:latest | |
podman manifest push centos-manifest docker://ghcr.io/gbraad-dotfiles/centos:stream9 | |
podman manifest push centos-manifest docker://ghcr.io/gbraad-dotfiles/centos:${{steps.get-tag.outputs.TAG}} | |
- name: Upload to release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ steps.get-tag.outputs.TAG }} | |
files: rootfs/*.tar.gz |