Skip to content

Docker TPL build

Docker TPL build #69

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-10, gcc-11]
env:
REPO: axom/tpls
HOSTCONFIG_LOC: /home/axom/export_hostconfig
DOCKERFILE_PREFIX: ./scripts/docker/dockerfile_
steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Get dockerfile name
shell: bash
run: echo "##[set-output name=filename;]$(echo ${DOCKERFILE_PREFIX}${{ matrix.compiler }})"
id: dockerfile_name
- name: Get dockerhub repo name
shell: bash
run: |
echo ${REPO}:${{ matrix.compiler }}_`date "+%m-%d-%y_%Hh-%Mm"`
echo "##[set-output name=repo_plus_tag;]$(echo ${REPO}:${{ matrix.compiler }}_`date "+%m-%d-%y_%Hh-%Mm"`)"
echo "##[set-output name=repo_plus_latest;]$(echo ${REPO}:${{ matrix.compiler }}_latest)"
id: repo_name
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
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@v2
with:
name: ${{ matrix.compiler }}_hostconfigs
path: ./extracted_hc/export_hostconfig/*