forked from danswer-ai/danswer
-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (56 loc) · 1.93 KB
/
gar-build-push-backend-container-on-tag.yml
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
name: (GAR) Build and Push Backend Image on Tag
on:
push:
tags:
- "*"
env:
GarProjectID: mv-auxiliary
GarImageName: prod-danswer-backend-gke
GarRepo: mv-danswer
GarCacheRepo: mv-apps-container-cache
jobs:
build-and-push:
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- name: Checkout Git repository
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: ${{ secrets.GCP_WIP }}
service_account: ${{ secrets.GCP_SA_EMAIL }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
- name: Login to GAR
uses: docker/login-action@v3
with:
registry: us-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
- uses: docker/metadata-action@v5
id: metadata
with:
images: |
us-docker.pkg.dev/${{ env.GarProjectID }}/${{ env.GarRepo }}/${{ env.GarImageName }}:${{ github.sha }}
- name: Web Image Docker Build and Push
uses: int128/kaniko-action@v1
with:
context: ./backend
file: ./backend/Dockerfile
push: true
cache: true
cache-repository: us-docker.pkg.dev/${{ env.GarProjectID }}/${{ env.GarCacheRepo }}/${{ env.GarImageName }}
labels: ${{ steps.metadata.outputs.labels }}
kaniko-args: |
--snapshot-mode=redo
--cache-ttl=730h
tags: |
us-docker.pkg.dev/${{ env.GarProjectID }}/${{ env.GarRepo }}/${{ env.GarImageName }}:${{ github.sha }}
us-docker.pkg.dev/${{ env.GarProjectID }}/${{ env.GarRepo }}/${{ env.GarImageName }}:latest
build-args: |
DANSWER_VERSION=${{ github.sha }}