Introduced in https://github.com/gem5/gem5/pull/236 the "docker-build.yaml" file will allow us to build and push docker images to the GitHub Container Registry. This allows for both automation of docker image building and allows us to utilize Github's zero-cost pulling policy for downloads to GitHub Actions runners. In this PR https://github.com/gem5/gem5/pull/236 has been altered to use Docker `buildx` which allows for multi-platform Docker Image builds. A multi-platform Docker image pull automatically pull the correct image for your platform from a single URL. In this prototype the images are build to both `linux/arm64` and `linux/amd64` have been set. Docker `buildx` has it's own file format for specifying image builds called `bake`. "util/dockerfiles/docker-bake.hcl" has been added with the goal of replacing "util/dockerfiles/docker-compose.yaml". In this proof-of-concept doesn't build all our docker images, just enough to ensure it works inside our actions as intended. Change-Id: Id0debed216c91ec514aa4fce3bc2ff4fc2ea669b
40 lines
1.1 KiB
YAML
40 lines
1.1 KiB
YAML
name: Docker images build and push
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
jobs:
|
|
# This builds and pushes the docker image.
|
|
build-and-push:
|
|
runs-on: [self-hosted, linux, x64, run]
|
|
permissions:
|
|
packages: write
|
|
contents: read
|
|
container: gcr.io/gem5-test/ubuntu-22.04_all-dependencies:latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
name: Checkout the develop branch
|
|
with:
|
|
# Scheduled workflows run on the default branch by default. We
|
|
# therefore need to explicitly checkout the develop branch.
|
|
ref: develop
|
|
|
|
- uses: docker/setup-qemu-action@v2
|
|
name: Setup QEMU
|
|
|
|
- uses: docker/setup-buildx-action@v2
|
|
name: Set up Docker Buildx
|
|
|
|
- uses: docker/login-action@v2
|
|
name: Login to the GitHub Container Registry
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and push with bake
|
|
uses: docker/bake-action@v3
|
|
with:
|
|
files: util/dockerfiles/docker-bake.hcl
|
|
push: true
|