-
Notifications
You must be signed in to change notification settings - Fork 11
57 lines (52 loc) · 1.98 KB
/
build_push_gpu_worker_image.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
name: Build and push GPU worker image
on:
pull_request:
types:
- closed
env:
GCR_REPO: gcr.io/${{ secrets.PROJECT_ID }}
jobs:
build_push_gpu_worker_image:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: auth
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCLOUD_PUSH_SERVICE_KEY }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ secrets.PROJECT_ID }}
- name: Download ml models
run: make update_resources
- name: Set env variables
run: |
export ML_IMAGES_BUCKET_CREDENTIALS_FILE=$(< docker/.env grep ML_IMAGES_BUCKET_CREDENTIALS_FILE | cut -d "=" -f 2)
echo ML_IMAGES_BUCKET_CREDENTIALS_FILE=$ML_IMAGES_BUCKET_CREDENTIALS_FILE >> $GITHUB_ENV
- name: Retrieve service key secret and decode it to a file
env:
SERVICE_ACCOUNT_B64: ${{ secrets.ML_IMAGES_SA_BASE64 }}
run: |
mkdir -p secrets
echo $SERVICE_ACCOUNT_B64 | base64 --decode > ${{ github.workspace }}${{env.ML_IMAGES_BUCKET_CREDENTIALS_FILE}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GCR
uses: docker/login-action@v2
with:
registry: gcr.io
username: _json_key
password: ${{ secrets.GCLOUD_PUSH_SERVICE_KEY }}
- name: Build GPU worker image
uses: docker/build-push-action@v4
with:
file: docker/prediction_gpu_worker.Dockerfile
context: .
push: true
tags: ${{env.GCR_REPO}}/prediction_gpu_worker:${{ github.event.number }},${{env.GCR_REPO}}/prediction_gpu_worker:latest
cache-from: type=registry,ref=${{env.GCR_REPO}}/prediction_gpu_worker:latest
cache-to: type=inline
build-args: |
ML_IMAGES_BUCKET_CREDENTIALS_FILE=${{env.ML_IMAGES_BUCKET_CREDENTIALS_FILE}}