diff --git a/.github/workflows/buildimage.yaml b/.github/workflows/buildimage.yaml new file mode 100644 index 0000000000..897b7af931 --- /dev/null +++ b/.github/workflows/buildimage.yaml @@ -0,0 +1,54 @@ +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