Add buildah composite action #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Docker timechain node image | |
on: | |
pull_request: | |
push: | |
branches: | |
- "ci/binary/**" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
DOCKER_REPO: analoglabs/timenode | |
jobs: | |
set-tags: | |
name: Get & set tags | |
runs-on: ubuntu-latest | |
outputs: | |
commit_hash: ${{ steps.get-sha.outputs.sha }} | |
commit_hash8: ${{ steps.get-sha.outputs.sha8 }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Get SHA | |
id: get-sha | |
run: | | |
sha=$(git log -1 --format='%H') | |
echo "sha=$sha" >> $GITHUB_OUTPUT | |
echo "sha8=$(git log -1 --format='%H' | cut -c1-8)" >> $GITHUB_OUTPUT | |
echo "SHA commit:" $sha | |
build-binary: | |
name: Build Docker image | |
needs: ["set-tags"] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- image: prod | |
profile: production | |
features: default | |
# - image: test | |
# profile: testnet | |
# features: default | |
# - image: dev | |
# profile: testnet | |
# features: development | |
steps: | |
- name: Fetch latest code | |
uses: actions/checkout@v3 | |
# - name: Set up QEMU | |
# uses: docker/setup-qemu-action@v2 | |
# - name: Set up Docker Buildx | |
# uses: docker/setup-buildx-action@v2 | |
- name: Install buildah | |
run: apt update && apt install buildah -y | |
# - name: Login to Docker Hub | |
# uses: docker/login-action@v2 | |
# with: | |
# username: ${{ secrets.DOCKERHUB_USERNAME }} | |
# password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build OCI Image | |
uses: ./.github/actions/buildah-action | |
with: | |
image_name: ${{ env.DOCKER_REPO }}-${{ matrix.image }}:${{ needs.set-tags.outputs.commit_hash8 }} | |
containerfile: ./config/docker/Dockerfile.release | |
context: . | |
volume: ${{ github.workspace }}/target:/build/target # Optional volume bind mount | |
username: ${{ secrets.DOCKERHUB_USERNAME }} # Optional registry username | |
password: ${{ secrets.DOCKERHUB_TOKEN }} # Optional registry password | |
registry: docker.io # Optional registry URL | |
push: 'false' # Optional push flag | |
build_args: | | |
PROFILE=${{ matrix.profile }} | |
VCS_REF=${{ needs.set-tags.outputs.commit_hash8 }} | |
BUILD_VARIANT=${{ matrix.image }} | |
FEATURES=${{ matrix.features }} | |
# - name: Build | |
# run: | | |
# buildah bud -v $PWD/target:/build/target \ | |
# -t timechain-node:${{ needs.set-tags.outputs.commit_hash8 }} \ | |
# -f config/docker/Dockerfile.release \ | |
# --build-arg PROFILE=production --build-arg VCS_REF=commit --build-arg BUILD_VARIANT=prod \ | |
# --dns '8.8.8.8' . | |
# - name: Build and push | |
# uses: docker/build-push-action@v4 | |
# with: | |
# context: . | |
# push: true | |
# tags: ${{ env.DOCKER_REPO }}-${{ matrix.image }}:${{ needs.set-tags.outputs.commit_hash8 }} | |
# file: config/docker/Dockerfile.release | |
# build-args: | | |
# VCS_REF=${{ needs.set-tags.outputs.commit_hash8 }} | |
# PROFILE=${{ matrix.profile }} | |
# FEATURES=${{ matrix.features }} | |
# BUILD_VARIANT=${{ matrix.image }} |