.make-image-envs: &make-image-envs - name: set IMAGE_VERSION script: echo -n "$CNB_BRANCH" | cut -d "/" -f1 exports: info: IMAGE_VERSION - name: use latest if main if: | [ "$CNB_BRANCH" = "main" ] script: echo -n "latest" exports: info: IMAGE_VERSION - name: set IMAGE_TAG script: echo -n "${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}:${IMAGE_VERSION}" exports: info: IMAGE_TAG .build-by-arch: &build-by-arch - name: docker login script: docker login -u ${CNB_TOKEN_USER_NAME} -p "${CNB_TOKEN}" ${CNB_DOCKER_REGISTRY} - name: set DOCKERFILE_DIR script: | if [ -f "docker/Dockerfile.linux.$BUILD_ARCH" ]; then echo -n "docker/Dockerfile.linux.$BUILD_ARCH" else echo -n "Dockerfile" fi exports: info: DOCKERFILE_DIR - name: docker build & push if: | [ -f $DOCKERFILE_DIR ] script: - docker build -f $DOCKERFILE_DIR -t $IMAGE_TAG-linux-$BUILD_ARCH . - docker push $IMAGE_TAG-linux-$BUILD_ARCH - name: resolve type: cnb:resolve options: key: build-$BUILD_ARCH .amd64-arch-build: &amd64-arch-build name: build-amd64 runner: tags: cnb:arch:amd64 services: - docker env: BUILD_ARCH: amd64 stages: - *make-image-envs - *build-by-arch .arm64-arch-build: &arm64-arch-build name: build-arm64 runner: tags: cnb:arch:arm64:v8 env: BUILD_ARCH: arm64 services: - docker stages: - *make-image-envs - *build-by-arch .multi-arch-push: &multi-arch-push - name: await the amd64 type: cnb:await options: key: build-amd64 - name: await the arm64 type: cnb:await options: key: build-arm64 - name: trigger market trans type: cnb:trigger options: token: $CNB_TOKEN slug: cnb/plugins/market branch: $CNB_BRANCH event: api_trigger_trans_image_to_dockerhub env: IMAGE_TAG: $IMAGE_TAG IMAGE_VERSION: $IMAGE_VERSION "(main|dev|staging)": push: - *amd64-arch-build - *arm64-arch-build - name: conbine-arch services: - docker stages: - *make-image-envs - *multi-arch-push $: tag_push: - *amd64-arch-build - *arm64-arch-build - name: conbine-arch services: - docker stages: - *make-image-envs - *multi-arch-push