Files
stacks-puppet-node/.github/workflows/image-build-alpine-binary.yml
wileyj 1da60adaab hardcode the dockerhub org (#3741)
* hardcode the dockerhub org

* rename base image to stacks-blockchain from stacks-node
2023-06-07 10:32:30 -07:00

82 lines
2.5 KiB
YAML

##
## Build the Docker Alpine image from the pre-built downloaded binary asset
##
name: Build Alpine 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 alpine images"
docker_platforms:
required: true
description: "Arch to buid alpine images"
type: string
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
# tag image with:
# latest: `latest`
# input tag: `<input tag>`
# git tag: `1234`
- name: Docker Metadata
id: docker_metadata
uses: docker/metadata-action@v4
with:
images: |
blockstack/${{ github.event.repository.name }}
tags: |
type=raw,value=latest,enable=${{ inputs.tag != '' && (github.ref == format('refs/heads/{0}', github.event.repository.default_branch) )}}
type=raw,value=${{ inputs.tag }},enable=${{ inputs.tag != '' }}
type=ref,event=tag,enable=true
- 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.alpine-binary
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