-
-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try to split image build using cross-compilation
- Loading branch information
Showing
3 changed files
with
85 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,23 +5,43 @@ on: | |
# - cron: '0 5 * * *' | ||
workflow_dispatch: | ||
|
||
# https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners | ||
|
||
jobs: | ||
build-images: | ||
runs-on: ubuntu-latest | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false # Do not stop when any job fails | ||
matrix: | ||
os: [ubuntu-latest] | ||
platform: ['linux/amd64'] | ||
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources | ||
include: | ||
- os: windows-2022 | ||
platform: windows/amd64 | ||
- os: ubuntu-latest | ||
platform: linux/arm64 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/[email protected] | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Set up Docker Buildx | ||
id: builder | ||
uses: docker/setup-buildx-action@master | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
if: ${{ matrix.platform == 'linux/arm64' }} | ||
|
||
- name: "Append ARM buildx builder from Oracle cloud" | ||
uses: baschny/append-buildx-action@v1 | ||
with: | ||
builder: ${{ steps.builder.outputs.name }} | ||
endpoint: ssh://${{ secrets.ARM_SSH_CONNECTION_STRING }} | ||
ssh_private_key: ${{ secrets.ARM_SSH_PRIVATE_KEY }} | ||
# - name: Set up Docker Buildx | ||
# id: builder | ||
# uses: docker/setup-buildx-action@v3 | ||
|
||
# - name: "Append ARM buildx builder from Oracle cloud" | ||
# uses: baschny/append-buildx-action@v1 | ||
# with: | ||
# builder: ${{ steps.builder.outputs.name }} | ||
# endpoint: ssh://${{ secrets.ARM_SSH_CONNECTION_STRING }} | ||
# ssh_private_key: ${{ secrets.ARM_SSH_PRIVATE_KEY }} | ||
|
||
- name: Extract branch name | ||
shell: bash | ||
|
@@ -36,24 +56,47 @@ jobs: | |
echo "tag=$SANITIZED_BRANCH" >> $GITHUB_OUTPUT | ||
id: extract_branch | ||
|
||
- name: Login to Docker registry | ||
uses: docker/login-action@v2 | ||
# - name: Login to Docker registry | ||
# uses: docker/login-action@v3 | ||
# with: | ||
# username: giskardai | ||
# password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
username: giskardai | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
# context: "{{defaultContext}}" | ||
context: . | ||
push: false #true | ||
tags: giskardai/giskard:${{ steps.extract_branch.outputs.tag }} | ||
platforms: ${{ matrix.platform }} | ||
|
||
- name: Build and push image based on the current branch | ||
env: | ||
IMAGE: docker.io/giskardai/giskard | ||
run: | | ||
docker buildx build \ | ||
--platform linux/amd64,linux/arm64 \ | ||
--tag $IMAGE:${{ steps.extract_branch.outputs.tag }} \ | ||
--file Dockerfile \ | ||
--push \ | ||
. | ||
- name: Invoke deployment hook | ||
if: ${{ steps.extract_branch.outputs.branch == 'main' }} | ||
run: | | ||
curl -L --silent --max-time 900 ${{ secrets.TEST_SERVER_WEBHOOK_URL_BASE }}/redeploy-dev | ||
# - uses: mr-smithers-excellent/docker-build-push@v6 | ||
# name: Build & push Docker image | ||
# with: | ||
# image: giskardai/giskard | ||
# tags: ${{ steps.extract_branch.outputs.tag }} | ||
# registry: docker.io | ||
# dockerfile: Dockerfile | ||
# enableBuildKit: true | ||
# platform: ${{ matrix.platform }} | ||
# multiPlatform: true | ||
# pushImage: false | ||
# # username: ${{ secrets.DOCKER_USERNAME }} | ||
# # password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
# - name: Build and push image based on the current branch | ||
# env: | ||
# IMAGE: docker.io/giskardai/giskard | ||
# run: | | ||
# docker buildx build \ | ||
# --platform linux/amd64,linux/arm64 \ | ||
# --tag $IMAGE:${{ steps.extract_branch.outputs.tag }} \ | ||
# --file Dockerfile \ | ||
# --push \ | ||
# . | ||
|
||
# - name: Invoke deployment hook | ||
# if: ${{ steps.extract_branch.outputs.branch == 'main' }} | ||
# run: | | ||
# curl -L --silent --max-time 900 ${{ secrets.TEST_SERVER_WEBHOOK_URL_BASE }}/redeploy-dev |
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