Building container - Ubuntu #73
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 - ubuntu | |
run-name: Building container - Ubuntu | |
on: | |
workflow_dispatch: | |
jobs: | |
build-arm64: | |
name: build-container-ubuntu-arm64 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-24.04-arm | |
steps: | |
- name: Install missing package | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
podman | |
- name: Run podman build - ubuntu-arm | |
run: | | |
podman build -t ghcr.io/gbraad-dotfiles/ubuntu:amd64 \ | |
--build-arg=ARCH="arm64" \ | |
-f .devcontainer/ubuntu/Containerfile . | |
- name: Run podman save - ubuntu-arm | |
run: | | |
podman save ghcr.io/gbraad-dotfiles/ubuntu:arm64 \ | |
--format=oci-dir -o oci-arm64 | |
- name: Run podman export - ubuntu | |
run: | | |
podman create --name ubuntu-arm64 \ | |
ghcr.io/gbraad-dotfiles/ubuntu:arm64 | |
podman export ubuntu-arm64 -o ubuntu-arm64.tar | |
gzip ubuntu-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: ubuntu-arm64.tar.gz | |
retention-days: 7 | |
build-amd64: | |
name: build-container-ubuntu-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 - ubuntu | |
run: | | |
podman build -t ghcr.io/gbraad-dotfiles/ubuntu:amd64 \ | |
-f .devcontainer/ubuntu/Containerfile . | |
- name: Run podman save - ubuntu | |
run: | | |
podman save ghcr.io/gbraad-dotfiles/ubuntu:amd64 \ | |
--format=oci-dir -o oci-amd64 | |
- name: Run podman export - ubuntu | |
run: | | |
podman create --name ubuntu-amd64 \ | |
ghcr.io/gbraad-dotfiles/ubuntu:amd64 | |
podman export ubuntu-amd64 -o ubuntu-amd64.tar | |
gzip ubuntu-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: ubuntu-amd64.tar.gz | |
retention-days: 7 | |
push-manifest: | |
name: build-container-ubuntu | |
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 ubuntu-manifest | |
- name: Add arm64 to manifest | |
run: | | |
podman manifest add ubuntu-manifest oci:$(pwd)/oci-arm64 | |
- name: Add amd64 to manifest | |
run: | | |
podman manifest add ubuntu-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 ubuntu-manifest docker://ghcr.io/gbraad-dotfiles/ubuntu:latest | |
podman manifest push ubuntu-manifest docker://ghcr.io/gbraad-dotfiles/ubuntu:noble | |
podman manifest push ubuntu-manifest docker://ghcr.io/gbraad-dotfiles/ubuntu:${{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 |