feat: add build to CI #1
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: Download a parent image, build a new one, and test it; then upload the image, tags, and manifests to GitHub artifacts | ||
env: | ||
REGISTRY_NAME: k8scc01covidacr | ||
DEV_REGISTRY_NAME: k8scc01covidacrdev | ||
LOCAL_REPO: localhost:5000 | ||
HADOLINT_VERSION: "2.12.0" | ||
on: | ||
workflow_call: | ||
inputs: | ||
parent-image: | ||
description: Parent image name | ||
required: true | ||
type: string | ||
parent-variant: | ||
description: Parent variant tag prefix | ||
required: false | ||
type: string | ||
default: default | ||
image: | ||
description: Image name | ||
required: true | ||
type: string | ||
variant: | ||
description: Variant tag prefix | ||
required: false | ||
type: string | ||
default: default | ||
jobs: | ||
build-test-upload: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Run Hadolint | ||
run: | | ||
sudo curl -L https://github.com/hadolint/hadolint/releases/download/v${{ env.HADOLINT_VERSION }}/hadolint-Linux-x86_64 --output hadolint | ||
sudo chmod +x hadolint | ||
./hadolint images/${{ inputs.image }}/Dockerfile --no-fail | ||
- name: Echo disk usage before clean up | ||
run: ./.github/scripts/echo_usage.sh | ||
- name: Free up all available disk space before building | ||
run: ./.github/scripts/cleanup_runner.sh | ||
- name: Echo disk usage before build start | ||
run: ./.github/scripts/echo_usage.sh | ||
# Connect to Azure Container registry (ACR) | ||
- uses: azure/docker-login@v1 | ||
with: | ||
login-server: ${{ env.REGISTRY_NAME }}.azurecr.io | ||
username: ${{ secrets.REGISTRY_USERNAME }} | ||
password: ${{ secrets.REGISTRY_PASSWORD }} | ||
# Connect to Azure DEV Container registry (ACR) | ||
- uses: azure/docker-login@v1 | ||
with: | ||
login-server: ${{ env.DEV_REGISTRY_NAME }}.azurecr.io | ||
username: ${{ secrets.DEV_REGISTRY_USERNAME }} | ||
password: ${{ secrets.DEV_REGISTRY_PASSWORD }} | ||
# make build emits full_image_name, image_tag, and image_repo outputs | ||
- name: Build image | ||
id: build-image | ||
run: make build/${{ input.image }} REPO=${{ env.LOCAL_REPO }} | ||
- name: Echo disk usage after build completion | ||
run: ./.github/scripts/echo_usage.sh |