-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add workflow for as to support cross compiling
Signed-off-by: Lei Li <[email protected]>
- Loading branch information
1 parent
ef5b640
commit 2624604
Showing
2 changed files
with
101 additions
and
1 deletion.
There are no files selected for viewing
100 changes: 100 additions & 0 deletions
100
.github/workflows/as-build-and-push-cross-compilation.yaml
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,100 @@ | ||
name: Build and Push CoCoAS / RVPS Image with cross-compilation supports | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build_and_push: | ||
permissions: | ||
packages: write | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
instance: | ||
- ubuntu-latest | ||
platform: | ||
- linux/amd64 | ||
- linux/s390x | ||
tag: | ||
- coco-as-grpc | ||
- coco-as-restful | ||
- rvps | ||
include: | ||
- docker_file: attestation-service/Dockerfile.as-grpc | ||
tag: coco-as-grpc | ||
name: gRPC CoCo-AS | ||
- docker_file: attestation-service/Dockerfile.as-restful | ||
tag: coco-as-restful | ||
name: RESTful CoCo-AS | ||
- docker_file: attestation-service/rvps/Dockerfile | ||
tag: rvps | ||
name: RVPS | ||
runs-on: ${{ matrix.instance }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to GHCR Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build ${{ matrix.name }} Container Image | ||
run: | | ||
commit_sha=${{ github.sha }} | ||
arch=$(uname -m) | ||
docker buildx build -f ${{ matrix.docker_file }} --load --build-arg ARCH=${arch} \ | ||
--platform ${{ matrix.platform }} \ | ||
-t ghcr.io/confidential-containers/staged-images/${{ matrix.tag }}:${commit_sha}-${arch} \ | ||
-t ghcr.io/confidential-containers/staged-images/${{ matrix.tag }}:latest-${arch} . | ||
publish_multi_arch_image: | ||
needs: build_and_push | ||
permissions: | ||
packages: write | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
tag: | ||
- coco-as-grpc | ||
- coco-as-restful | ||
- rvps | ||
include: | ||
- tag: coco-as-grpc | ||
name: gRPC CoCo-AS | ||
- tag: coco-as-restful | ||
name: RESTful CoCo-AS | ||
- tag: rvps | ||
name: RVPS | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to GHCR Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Publish Multi-arch Image for ${{ matrix.name }} | ||
run: | | ||
commit_sha=${{ github.sha }} | ||
docker manifest create ghcr.io/confidential-containers/staged-images/${{ matrix.tag }}:${commit_sha} \ | ||
--amend ghcr.io/confidential-containers/staged-images/${{ matrix.tag }}:${commit_sha}-s390x \ | ||
--amend ghcr.io/confidential-containers/staged-images/${{ matrix.tag }}:${commit_sha}-x86_64 | ||
docker manifest inspect ghcr.io/confidential-containers/staged-images/${{ matrix.tag }}:${commit_sha} | ||
docker manifest create ghcr.io/confidential-containers/staged-images/${{ matrix.tag }}:latest \ | ||
--amend ghcr.io/confidential-containers/staged-images/${{ matrix.tag }}:latest-s390x \ | ||
--amend ghcr.io/confidential-containers/staged-images/${{ matrix.tag }}:latest-x86_64 | ||
docker manifest inspect ghcr.io/confidential-containers/staged-images/${{ matrix.tag }}:latest |
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