Build and push to ACR #110
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 and push to ACR | |
on: | |
workflow_dispatch: | |
push: | |
branches: "master" | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
- cron: "0 0 * * Tue" | |
jobs: | |
main: | |
runs-on: ubuntu-22.04 | |
env: | |
AZURE_CONTAINER_REGISTRY_URL: hmctspublic.azurecr.io | |
steps: | |
- name: Checkout Source | |
uses: actions/checkout@v4 | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Login to Azure Container Repository | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.AZURE_CONTAINER_REGISTRY_URL }} | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: Generate build ID | |
id: prep | |
run: | | |
sha=${GITHUB_SHA::8} | |
ts=$(date +%s) | |
echo "::set-output name=BUILD_ID::${sha}-${ts}" | |
- name: Build and Push | |
id: docker_build | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ env.AZURE_CONTAINER_REGISTRY_URL }}/rpe/response-api:prod-${{ steps.prep.outputs.BUILD_ID }} |