-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow to build base images (#189)
Add workflow to build and push base images, and then update tags on relevant files.
- Loading branch information
1 parent
84f906d
commit ab1f8b2
Showing
2 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Build base images | ||
on: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
id-token: write | ||
contents: write | ||
|
||
jobs: | ||
|
||
build-and-push: | ||
runs-on: ubuntu-latest | ||
environment: build | ||
strategy: | ||
matrix: | ||
include: | ||
- dockerfile: Dockerfile-services-base | ||
image-name: services-base | ||
- dockerfile: Dockerfile-worker-base | ||
image-name: worker-base | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: dev | ||
- 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 }} | ||
VERSION_TAG=${{ github.run_id }} | ||
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 | ||
update-tags: | ||
needs: build-and-push | ||
runs-on: ubuntu-latest | ||
environment: build | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: dev | ||
ssh-key: ${{ secrets.WORKFLOW_KEY }} | ||
- name: 'Update tags' | ||
run: | | ||
TAG=${{ github.run_id }} | ||
sed -i "s|\(\s\+image.*:\).*|\1${TAG}|" ./.github/workflows/lint-test.yml | ||
sed -i "s|\(FROM.*:\).*|\1${TAG}|" ./resources/docker/Dockerfile-api_orchestrator | ||
sed -i "s|\(FROM.*:\).*|\1${TAG}|" ./resources/docker/Dockerfile-cache | ||
sed -i "s|\(FROM.*:\).*|\1${TAG}|" ./resources/docker/Dockerfile-worker | ||
sed -i "s|\(FROM.*:\).*|\1${TAG}|" ./resources/docker/Dockerfile-devcontainer | ||
- name: Commit changes | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "FarmVibes.AI Release Pipeline" | ||
BRANCH=update-base-${{ github.run_id }} | ||
git checkout -b $BRANCH | ||
git add ./.github/workflows/lint-test.yml | ||
git add ./resources/docker/ | ||
git commit -m "Update base tag to latest image" | ||
git push --set-upstream origin $BRANCH |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ on: | |
permissions: | ||
id-token: write | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
release: | ||
|