## ## Build the Docker Debian image from the pre-built downloaded binary asset ## name: Build Linux Binary Image # Only run when: # - manually triggered via the ci.yml workflow on: workflow_call: inputs: tag: required: true type: string description: "semver tag for linux images" docker_platforms: required: true description: "Arch to buid linux images" type: string linux_version: required: true description: "Linux image to build" type: string default: debian build_type: required: true description: Build type (source/binary) type: string default: binary secrets: DOCKERHUB_USERNAME: required: true DOCKERHUB_PASSWORD: required: true jobs: image: # Only run if a tag is provided manually if: ${{ inputs.tag != '' }} name: Build Image runs-on: ubuntu-latest steps: - name: Checkout the latest code id: git_checkout uses: actions/checkout@v3 - name: Set Vars id: set_vars run: | echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV echo "GITHUB_REF_SHORT=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - name: Set up QEMU id: docker_qemu uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx id: docker_buildx uses: docker/setup-buildx-action@v2 - name: Extract branch name id: extract_branch run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV # tag image with: # branch name: `latest-` # input tag: `-` - name: Docker Metadata id: docker_metadata uses: docker/metadata-action@v4 with: images: | blockstack/${{ github.event.repository.name }} tags: | type=raw,value=latest-${{ inputs.linux_version }},enable=${{ inputs.tag != '' && (github.ref == format('refs/heads/{0}', github.event.repository.default_branch) )}} type=raw,value=${{ inputs.tag }}-${{ inputs.linux_version }},enable=${{ inputs.tag != '' }} - name: Login to DockerHub id: docker_login uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - name: Build and Push id: docker_build uses: docker/build-push-action@v3 with: file: ./.github/actions/dockerfiles/Dockerfile.${{ inputs.linux_version }}-${{ inputs.build_type }} platforms: ${{ inputs.docker_platforms }} tags: ${{ steps.docker_metadata.outputs.tags }} labels: ${{ steps.docker_metadata.outputs.labels }} build-args: | TAG=${{ inputs.tag}} STACKS_NODE_VERSION=${{ inputs.tag || env.GITHUB_SHA_SHORT }} GIT_BRANCH=${{ env.GITHUB_REF_SHORT }} GIT_COMMIT=${{ env.GITHUB_SHA_SHORT }} push: true