Add buildah composite action #7
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 chronicle image | |
on: | |
pull_request: | |
push: | |
paths: | |
- '.github/workflows/merge-docker-chronicle.yaml' | |
- 'chronicle/**' | |
- 'config/subxt/**' | |
- 'lib/**' | |
- 'primitives/**' | |
- 'tc-subxt/**' | |
- 'tss/**' | |
- 'Cargo.toml' | |
- 'Cargo.lock' | |
- 'rust-toolchain.toml' | |
branches: | |
- 'development' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
DOCKER_REPO: analoglabs/chronicle | |
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: ["self-hosted", "container"] | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- image: prod | |
profile: production | |
- image: dev | |
profile: testnet | |
steps: | |
- name: Fetch latest code | |
uses: actions/checkout@v3 | |
- name: Create target dir | |
run: mkdir -p ${{ github.workspace }}/target/${{ matrix.profile }} | |
- name: Cache Rust deps | |
uses: actions/cache@v3 | |
with: | |
path: ${{ github.workspace }}/target/${{matrix.profile}} | |
key: docker-chronicle-${{ matrix.profile }}-${{ hashFiles('Cargo.lock', 'config/docker/Dockerfile.chronicle-release') }} | |
- 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.chronicle-release | |
context: . | |
volume: ${{ github.workspace }}/target/${{ matrix.profile }}:/build/target/${{ matrix.profile }} | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
registry: docker.io | |
push: 'true' | |
build_args: | | |
VCS_REF=${{ needs.set-tags.outputs.commit_hash8 }} | |
PROFILE=${{ matrix.profile }} | |