-
Notifications
You must be signed in to change notification settings - Fork 2
69 lines (62 loc) · 2.55 KB
/
build-push-image-acr.yml
File metadata and controls
69 lines (62 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Build and push image to ACR
env:
aws_region: us-east-1
on:
workflow_call:
inputs:
tags:
type: string
description: The tags to use for the image, separated by commas
registry:
type: string
description: The registry to use for the image
repository:
type: string
description: The repository to use for the image
context:
type: string
description: The context to use for building the image
build_args:
type: string
description: The build arguments to use for building the image
secrets:
acr_registry_username:
required: true
acr_registry_password:
required: true
tlm_core_access_token:
required: true
jobs:
build-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Login to Azure Container Registry
uses: azure/docker-login@v1
with:
login-server: ${{ inputs.registry }}
username: ${{ secrets.acr_registry_username }}
password: ${{ secrets.acr_registry_password }}
- name: Set variables
id: set-variables
run: |
tags=$(echo "${{ inputs.tags }}" | tr ',' '\n' | sed "s|^|${{ inputs.registry }}/${{ inputs.repository }}:|" | tr '\n' ',')
echo "image_tags=$tags" >> $GITHUB_OUTPUT
# TODO: this is only for chat-backend, but passing in to all images
echo "tlm_core_url=git+https://${{ secrets.tlm_core_access_token }}@github.com/cleanlab/tlm-core.git" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push image
id: build-push-image
uses: docker/build-push-action@v6
with:
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.set-variables.outputs.image_tags }}
context: ${{ inputs.context }}
target: hosted
cache-from: type=gha,scope=${{ inputs.context }}-buildcache
cache-to: type=gha,scope=${{ inputs.context }}-buildcache,mode=max
build-args: |
TLM_CORE_URL=${{ steps.set-variables.outputs.tlm_core_url }}