-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build multiplatform docker images (#430)
* Build multiplatform docker images * try to start from scratch * Try QEMU action * Restore missing jobs and clean up the whitespace * Split the CI jobs, and run the docker build only on merge to master
- Loading branch information
Showing
3 changed files
with
62 additions
and
38 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
env: | ||
CERBERUS_IMAGE_ID: ghcr.io/rems-project/cerberus/cn:release | ||
|
||
# cancel in-progress job when a new push is performed | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
deploy-docker: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
platform: [linux/amd64, linux/arm64] | ||
permissions: | ||
packages: write | ||
contents: read | ||
attestations: write | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Build the Docker image | ||
run: | | ||
echo "Building ${{env.CERBERUS_IMAGE_ID}}" | ||
PLATFORM=${{ matrix.platform }} make -f Makefile_docker release_cn | ||
docker tag cn:release ${{env.CERBERUS_IMAGE_ID}} | ||
- name: Push the Docker image | ||
run: docker push ${{env.CERBERUS_IMAGE_ID}} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
.PHONY: all release dev-env deps | ||
|
||
PLATFORM ?= linux/amd64 | ||
$(info Building for platform $(PLATFORM)) | ||
|
||
all: | ||
@echo 'targets: deps|release|dev-env' | ||
|
||
deps : | ||
docker build --tag cerberus:deps -f Dockerfile.deps . | ||
docker build --platform $(PLATFORM) --tag cerberus:deps -f Dockerfile.deps . | ||
|
||
release: deps | ||
docker build --tag cerberus:release -f Dockerfile.release . | ||
docker build --platform $(PLATFORM) --tag cerberus:release -f Dockerfile.release . | ||
@echo 'for example: docker run --volume `PWD`:/data/ cerberus:release cerberus tests/tcc/00_assignment.c --pp=core' | ||
|
||
release_cn: deps | ||
docker build --tag cn:release -f Dockerfile.release . | ||
docker build --platform $(PLATFORM) --tag cn:release -f Dockerfile.release . | ||
@echo 'for example: docker run --volume `PWD`:/data/ cn:release cerberus tests/tcc/00_assignment.c --pp=core' | ||
|
||
dev-env: deps | ||
docker build --tag cerberus:dev-env -f Dockerfile.dev-env . | ||
docker build --platform $(PLATFORM) --tag cerberus:dev-env -f Dockerfile.dev-env . | ||
@echo 'for example: docker run -ti --volume `PWD`:/home/user1/cerberus/ cerberus:dev-env' |