Skip to content

Commit

Permalink
Add arm platform for every build, force push from PR
Browse files Browse the repository at this point in the history
  • Loading branch information
Anmol1696 committed Jun 28, 2023
1 parent 6564967 commit 353a524
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Build
if: github.event_name == 'pull_request'
run: |
./scripts/build-docker.sh --type ${{ matrix.build-type }} --process all --version all
./scripts/build-docker.sh --type ${{ matrix.build-type }} --process all --version all --push
- name: Build and push
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
Expand Down Expand Up @@ -87,7 +87,7 @@ jobs:
- name: Build chains
if: github.event_name == 'pull_request'
run: |
cd docker/chains && ./build-docker-chains.sh --chain all --tag all
cd docker/chains && ./build-docker-chains.sh --chain all --tag all --push
- name: Build and push all chains
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
Expand Down
10 changes: 10 additions & 0 deletions docker/chains/build-docker-chains.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ function color() {
printf "\033[%sm%s\033[0m\n" "$color_code" "$*"
}

function set_docker_buildx() {
set +e
out=$(docker buildx create --name chain-builder --use > /dev/null 2>&1)
if [[ $? -ne 0 ]]; then
docker buildx use chain-builder
fi
set -e
}

function image_tag_exists() {
local image=$1
local tag=$2
Expand Down Expand Up @@ -130,6 +139,7 @@ while [ $# -gt 0 ]; do
esac
done

set_docker_buildx

if [[ $CHAIN == "all" ]]; then
build_all_chains $PUSH
Expand Down
14 changes: 13 additions & 1 deletion scripts/build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ function color() {
printf "\033[%sm%s\033[0m\n" "$color_code" "$*"
}

function set_docker_buildx() {
set +e
out=$(docker buildx create --name chain-builder --use > /dev/null 2>&1)
if [[ $? -ne 0 ]]; then
docker buildx use chain-builder
fi
set -e
}

function is_directory {
if [ -d "$1" ]; then
return 0 # true
Expand Down Expand Up @@ -86,7 +95,8 @@ docker_process_build() {
if [[ "$push_image" != "push-only" ]]; then
color yellow "building docker image $DOCKER_REPO/$process:$tag from file $DOCKER_DIR/$type/$process/Dockerfile"
for n in {1..3}; do
docker buildx build --platform linux/amd64 \
docker buildx build \
--platform linux/amd64,linux/arm64 \
-t "$DOCKER_REPO/$process:$tag" . \
--build-arg BASE_IMAGE=$base \
--build-arg VERSION=$version \
Expand Down Expand Up @@ -185,6 +195,8 @@ while [ $# -gt 0 ]; do
esac
done

set_docker_buildx

if [[ $TYPE == "all" ]]; then
build_all_types "all" "all" "all" $PUSH $PUSH_LATEST
exit 0
Expand Down

0 comments on commit 353a524

Please sign in to comment.