Skip to content

Build Docker Images #47

Build Docker Images

Build Docker Images #47

Workflow file for this run

---
# Automatically build Docker images on changes to main and push them to a
# Container Registry using HCL Bake file.
name: Build Docker Images
# yamllint disable-line rule:truthy
on:
workflow_dispatch:
push:
branches: ['main','demo_*','hackathon_*']
tags: ['*']
pull_request:
branches: ['main']
permissions:
contents: read
packages: write
jobs:
# Call the Tag Generator to generate an image tag to use
tag-generator:
uses: darpa-askem/.github/.github/workflows/tag-generator.yaml@main
publish:
name: sequence-build-deploy
runs-on: ubuntu-22.04
needs:
- tag-generator
steps:
- name: Set env variables for bakefiles
run: |
# Lowercase the inputs for Docker image naming conventions
TAG=${{ needs.tag-generator.outputs.tag }}
ORG=${{ github.repository_owner }}
# REG=${{ inputs.registry }}
echo "VERSION=${TAG,,}" >> ${GITHUB_ENV}
echo "DOCKER_ORG=${ORG,,}" >> ${GITHUB_ENV}
# echo "DOCKER_REGISTRY=${REG,,}" >> ${GITHUB_ENV}
- name: Checkout
uses: actions/checkout@v3
- name: Login to registry
uses: docker/login-action@v2
with:
registry: 'ghcr.io'
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# 2.4 - Setup QEMU for platform emulation
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
# 2.5 - Setup Docker BuildX for multi platform building
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# 2.6 - Build and push Docker Images
- name: Build Images using BuildX Bake
uses: docker/[email protected]
with:
files: |
./docker/docker-bake.hcl
targets: funman-api-multiplatform
push: true
set: |
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
# # Build and Publish all targets associated with specified group
# bake:
# needs:
# - tag-generator
# uses: darpa-askem/.github/.github/workflows/bake-publish.yml@main
# with:
# file: 'docker-bake.hcl'
# group: 'prod'
# registry: 'ghcr.io'
# organization: ${{ github.repository_owner }}
# tag: ${{ needs.tag-generator.outputs.tag }}
# secrets:
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GITHUB_TOKEN }}