Skip to content

Commit

Permalink
ci: add base image, prepared for arm64 compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
Kosette committed Oct 1, 2024
1 parent 94c81ba commit bb0ea01
Show file tree
Hide file tree
Showing 9 changed files with 289 additions and 165 deletions.
104 changes: 104 additions & 0 deletions .github/workflows/build_image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Build and Push Ubuntu-rust-gtk4
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "docker"
schedule:
- cron: "15 8 1 */1 *"

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
packages: write
strategy:
fail-fast: false
matrix:
include:
- platform: amd64
arch: amd64
- platform: arm64
arch: arm64v8

steps:
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Github Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Metadata
run: |
echo "OWNER=${GITHUB_REPOSITORY_OWNER@L}" >> ${GITHUB_ENV}
- name: Build and push for ${{ matrix.platform }}
uses: docker/build-push-action@v6
with:
context: docker
platforms: linux/${{ matrix.platform }}
push: true
tags: |
ghcr.io/${{ env.OWNER }}/ubuntu-rust-gtk4:${{ matrix.platform }}
build-args: |
ARCH=${{ matrix.arch }}
provenance: false

merge:
needs: build-and-push
runs-on: ubuntu-latest
permissions:
packages: write
strategy:
fail-fast: false

steps:
- name: Login to Github Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Metadata
id: date
run: |
echo "OWNER=${GITHUB_REPOSITORY_OWNER@L}" >> ${GITHUB_ENV}
echo "date=$(date --rfc-3339=date)" >> ${GITHUB_OUTPUT}
- name: Create multi-arch manifest for latest tag
run: |
docker manifest create ghcr.io/${{ env.OWNER }}/ubuntu-rust-gtk4:latest \
ghcr.io/${{ env.OWNER }}/ubuntu-rust-gtk4:amd64 \
ghcr.io/${{ env.OWNER }}/ubuntu-rust-gtk4:arm64
docker manifest annotate ghcr.io/${{ env.OWNER }}/ubuntu-rust-gtk4:latest \
ghcr.io/${{ env.OWNER }}/ubuntu-rust-gtk4:amd64 --arch amd64
docker manifest annotate ghcr.io/${{ env.OWNER }}/ubuntu-rust-gtk4:latest \
ghcr.io/${{ env.OWNER }}/ubuntu-rust-gtk4:arm64 --arch arm64
docker manifest push ghcr.io/${{ env.OWNER }}/ubuntu-rust-gtk4:latest
- name: Create multi-arch manifest for date tag
run: |
docker manifest create ghcr.io/${{ env.OWNER }}/ubuntu-rust-gtk4:${{ steps.date.outputs.date }} \
ghcr.io/${{ env.OWNER }}/ubuntu-rust-gtk4:amd64 \
ghcr.io/${{ env.OWNER }}/ubuntu-rust-gtk4:arm64
docker manifest annotate ghcr.io/${{ env.OWNER }}/ubuntu-rust-gtk4:${{ steps.date.outputs.date }} \
ghcr.io/${{ env.OWNER }}/ubuntu-rust-gtk4:amd64 --arch amd64
docker manifest annotate ghcr.io/${{ env.OWNER }}/ubuntu-rust-gtk4:${{ steps.date.outputs.date }} \
ghcr.io/${{ env.OWNER }}/ubuntu-rust-gtk4:arm64 --arch arm64
docker manifest push ghcr.io/${{ env.OWNER }}/ubuntu-rust-gtk4:${{ steps.date.outputs.date }}
- name: Check push
run: |
docker buildx imagetools inspect ghcr.io/${{ env.OWNER }}/ubuntu-rust-gtk4:latest
File renamed without changes.
Loading

0 comments on commit bb0ea01

Please sign in to comment.