This repository has been archived by the owner on Sep 25, 2024. It is now read-only.
Add docker build job #4
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: Locust build image | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- "master" | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
contents: read | |
id-token: write | |
concurrency: | |
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}" | |
cancel-in-progress: true | |
env: | |
REGISTRY: us-east1-docker.pkg.dev/acuitymd-core-services/python | |
TAG: ${{ github.sha }} | |
ENV: dev | |
jobs: | |
build-locust: | |
name: Locust build image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Authenticate to Google Cloud | |
id: auth | |
uses: google-github-actions/auth@v2 | |
with: | |
token_format: "access_token" | |
workload_identity_provider: ${{ vars.DEV_GCP_GHA_WORKLOAD_IDP}} | |
service_account: ${{ vars.DEV_GCP_GHA_SERVICE_ACCOUNT}} | |
- name: Login to Google Artifact Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: oauth2accesstoken | |
password: ${{ steps.auth.outputs.access_token }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and Pushs | |
uses: docker/build-push-action@v5 | |
env: | |
APP: locust | |
with: | |
file: ./Dockerfile | |
push: true | |
provenance: false | |
tags: ${{ env.REGISTRY }}/${{ env.APP }}:${{ env.TAG }}, ${{ env.REGISTRY }}/${{ env.APP }}:latest | |
platforms: linux/amd64 | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |