Skip to content

Docker TPL build

Docker TPL build #78

name: Docker TPL build
# Manually triggered
on:
workflow_dispatch:
# No input required
jobs:
build_images:
runs-on: ubuntu-latest
name: Builds a docker image and extracts generated hostconfigs
strategy:
matrix:
compiler: [clang-14, gcc-13]
env:
REPO: axom/tpls
HOSTCONFIG_LOC: /home/axom/export_hostconfig
DOCKERFILE_PREFIX: ./scripts/docker/dockerfile_
steps:
- name: Extract branch name
shell: bash
run: |
echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
id: extract_branch
- name: Get dockerfile name
shell: bash
run: |
echo "filename=$(echo ${DOCKERFILE_PREFIX}${{ matrix.compiler }})" >> $GITHUB_OUTPUT
id: dockerfile_name
- name: Get dockerhub repo name
shell: bash
run: |
repo_plus_tag=$(echo ${REPO}:${{ matrix.compiler }}_`date "+%m-%d-%y_%Hh-%Mm"`) && export repo_plus_tag
echo $repo_plus_tag
echo "repo_plus_tag=$repo_plus_tag" >> $GITHUB_OUTPUT
echo "repo_plus_latest=$(echo ${REPO}:${{ matrix.compiler }}_latest)" >> $GITHUB_OUTPUT
id: repo_name
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ steps.repo_name.outputs.repo_plus_tag }},${{ steps.repo_name.outputs.repo_plus_latest }}
file: ${{ steps.dockerfile_name.outputs.filename }}
context: .
platforms: linux/amd64
build-args: branch=${{ steps.extract_branch.outputs.branch }}
- name: Get hostconfig
run: |
echo ${{ steps.docker_build.outputs.digest }}
docker pull ${{ steps.repo_name.outputs.repo_plus_tag }}
docker create --name extract_hc ${{ steps.repo_name.outputs.repo_plus_tag }}
mkdir -p extracted_hc
docker cp extract_hc:${{ env.HOSTCONFIG_LOC }} ./extracted_hc
docker rm extract_hc
- name: Upload hostconfig
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.compiler }}_hostconfigs
path: ./extracted_hc/export_hostconfig/*