Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflow to build and push container images #182

Merged
merged 11 commits into from
Aug 1, 2024
39 changes: 39 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build service images
on:
push:
branches:
- dev
- main

permissions:
id-token: write
contents: read
jobs:
build-and-push:
runs-on: ubuntu-latest
environment: build
strategy:
matrix:
include:
- dockerfile: Dockerfile-api_orchestrator
image-name: api-orchestrator
- dockerfile: Dockerfile-worker
image-name: worker
- dockerfile: Dockerfile-cache
image-name: cache
steps:
- uses: actions/checkout@v4
- name: 'Az CLI login'
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: 'Build and push image'
run: |
az acr login -n ${{ secrets.ACR_NAME }}
export VERSION_TAG=${GITHUB_REF#refs/heads/}
export IMAGE_TAG=${{ secrets.ACR_NAME }}.azurecr.io/unlisted/farmai/terravibes/${{ matrix.image-name }}:$VERSION_TAG
docker build . -f ./resources/docker/${{ matrix.dockerfile }} -t $IMAGE_TAG
docker push $IMAGE_TAG

Loading