Building container - Debian #202
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 - debian | |
run-name: Building container - Debian | |
on: | |
workflow_dispatch: | |
jobs: | |
build-arm64: | |
name: build-container-debian-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: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Run podman build - debian-arm | |
run: | | |
podman build -t ghcr.io/gbraad-dotfiles/debian:arm64 \ | |
--build-arg=ARCH="arm64" \ | |
-f .devcontainer/debian/Containerfile . | |
- name: Run podman save - debian-arm | |
run: | | |
podman save ghcr.io/gbraad-dotfiles/debian:arm64 \ | |
--format=oci-dir -o oci-arm64 | |
- name: Run podman export - debian | |
run: | | |
podman create --name debian-arm64 \ | |
ghcr.io/gbraad-dotfiles/debian:arm64 | |
podman export debian-arm64 -o debian-arm64.tar | |
gzip debian-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: debian-arm64.tar.gz | |
retention-days: 7 | |
build-amd64: | |
name: build-container-debian-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 - debian | |
run: | | |
podman build -t ghcr.io/gbraad-dotfiles/debian:amd64 \ | |
-f .devcontainer/debian/Containerfile . | |
- name: Run podman save - debian | |
run: | | |
podman save ghcr.io/gbraad-dotfiles/debian:amd64 \ | |
--format=oci-dir -o oci-amd64 | |
- name: Run podman export - debian | |
run: | | |
podman create --name debian-amd64 \ | |
ghcr.io/gbraad-dotfiles/debian:amd64 | |
podman export debian-amd64 -o debian-amd64.tar | |
gzip debian-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: debian-amd64.tar.gz | |
retention-days: 7 | |
push-manifest: | |
name: build-container-debian | |
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 debian-manifest | |
- name: Add arm64 to manifest | |
run: | | |
podman manifest add debian-manifest oci:$(pwd)/oci-arm64 | |
- name: Add amd64 to manifest | |
run: | | |
podman manifest add debian-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 debian-manifest docker://ghcr.io/gbraad-dotfiles/debian:latest | |
podman manifest push debian-manifest docker://ghcr.io/gbraad-dotfiles/debian:bookworm | |
podman manifest push debian-manifest docker://ghcr.io/gbraad-dotfiles/debian:${{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 |