diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 92c4b1d3..f0fd9452 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -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' @@ -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' diff --git a/docker/chains/build-docker-chains.sh b/docker/chains/build-docker-chains.sh index 203684bb..0423f72e 100755 --- a/docker/chains/build-docker-chains.sh +++ b/docker/chains/build-docker-chains.sh @@ -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 @@ -130,6 +139,7 @@ while [ $# -gt 0 ]; do esac done +set_docker_buildx if [[ $CHAIN == "all" ]]; then build_all_chains $PUSH diff --git a/scripts/build-docker.sh b/scripts/build-docker.sh index 96626c01..1e3c69e6 100755 --- a/scripts/build-docker.sh +++ b/scripts/build-docker.sh @@ -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 @@ -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 \ @@ -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