Yakobus Iryanto Prasethio commited on
Commit
5a2c3e3
·
unverified ·
2 Parent(s): be3d589 28b9595

Merge pull request #6 from YakobusIP/main

Browse files
.github/workflows/ci-production.yml DELETED
@@ -1,68 +0,0 @@
1
- name: Deploy to Google Vertex AI
2
-
3
- on:
4
- push:
5
- branches:
6
- - production
7
- path:
8
- - "core-model-prediction/**"
9
- - ".github/workflows/**"
10
-
11
- jobs:
12
- setup-build-publish-deploy:
13
- name: Setup, Build, Publish, and Deploy
14
- runs-on: ubuntu-latest
15
-
16
- steps:
17
- - name: Checkout code
18
- uses: actions/checkout@v2
19
-
20
- - name: Set up Cloud SDK
21
- uses: google-github-actions/setup-gcloud@v0.2.0
22
- with:
23
- project_id: ${{ secrets.GCP_PROJECT_ID }}
24
- service_account_key: ${{ secrets.GCP_DEPLOYER_SA_KEY }}
25
- export_default_credentials: true
26
-
27
- - name: Authenticate Docker
28
- run: |
29
- gcloud auth configure-docker ${{ secrets.GCP_REPO_REGION }}-docker.pkg.dev --quiet
30
-
31
- - name: Build image
32
- working-directory: ./core-model-prediction
33
- run: docker build . --file Dockerfile --tag ${{ secrets.GCP_REPO_REGION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/interview-ai-detector/model-prediction
34
-
35
- - name: Push image
36
- run: docker push ${{ secrets.GCP_REPO_REGION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/interview-ai-detector/model-prediction
37
-
38
- - name: Create model
39
- id: create_model
40
- run: |
41
- MODEL_ID=$(gcloud ai models upload \
42
- --region="${{ secrets.GCP_VERTEX_AI_REGION }}" \
43
- --container-ports=8080 \
44
- --container-image-uri="${{ secrets.GCP_REPO_REGION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/interview-ai-detector/model-prediction:latest" \
45
- --container-predict-route="/predict" \
46
- --container-health-route="/health" \
47
- --display-name=interview-ai-detector-model \
48
- --format="value(model)")
49
- echo "MODEL_ID=${MODEL_ID}" >> $GITHUB_ENV
50
-
51
- - name: Create Vertex AI endpoint
52
- id: create_endpoint
53
- run: |
54
- ENDPOINT_ID=$(gcloud ai endpoints create \
55
- --region=${{ secrets.GCP_VERTEX_AI_REGION }} \
56
- --display-name=interview-ai-detector-endpoint \
57
- --format="value(name)")
58
- echo "ENDPOINT_ID=${ENDPOINT_ID}" >> $GITHUB_ENV
59
-
60
- - name: Deploy model to endpoint
61
- run: |
62
- gcloud ai endpoints deploy-model ${{ env.ENDPOINT_ID }} \
63
- --region=${{ secrets.GCP_VERTEX_AI_REGION }} \
64
- --model=${{ env.MODEL_ID }} \
65
- --display-name=interview-ai-detector-deployment \
66
- --machine-type="n1-standard-4" \
67
- --accelerator=count=1,type=nvidia-tesla-t4 \
68
- --service-account=${{ secrets.GCP_VERTEX_AI_SA_EMAIL }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
__pycache__/gemma2b.cpython-312.pyc DELETED
Binary file (4.16 kB)
 
__pycache__/hypothesis.cpython-312.pyc DELETED
Binary file (7.68 kB)
 
__pycache__/prediction.cpython-312.pyc DELETED
Binary file (3.39 kB)
 
core-model-prediction/cloudbuild.yaml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ steps:
2
+ - name: "docker"
3
+ dir: "core-model-prediction"
4
+ args:
5
+ [
6
+ "builds",
7
+ "submit",
8
+ "--tag",
9
+ "gcr.io/$PROJECT_ID/interview-ai-detector/model-prediction",
10
+ ]
11
+
12
+ - name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
13
+ entrypoint: "bash"
14
+ args:
15
+ - "-c"
16
+ - |
17
+ MODEL_ID=$(gcloud ai models upload \
18
+ --region="$_GCP_VERTEX_AI_REGION" \
19
+ --container-ports=8080 \
20
+ --container-image-uri="gcr.io/$PROJECT_ID/interview-ai-detector/model-prediction:latest" \
21
+ --container-predict-route="/predict" \
22
+ --container-health-route="/health" \
23
+ --display-name="interview-ai-detector-model" \
24
+ --format="value(model)")
25
+ echo "MODEL_ID=${MODEL_ID}"
26
+
27
+ - name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
28
+ entrypoint: "bash"
29
+ args:
30
+ - "-c"
31
+ - |
32
+ ENDPOINT_ID=$(gcloud ai endpoints create \
33
+ --region="$_GCP_VERTEX_AI_REGION" \
34
+ --display-name="interview-ai-detector-endpoint" \
35
+ --format="value(name)")
36
+ echo "ENDPOINT_ID=${ENDPOINT_ID}"
37
+
38
+ - name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
39
+ entrypoint: "bash"
40
+ args:
41
+ - "-c"
42
+ - |
43
+ gcloud ai endpoints deploy-model "$ENDPOINT_ID" \
44
+ --region="$_GCP_VERTEX_AI_REGION" \
45
+ --model="$MODEL_ID" \
46
+ --display-name="interview-ai-detector-deployment" \
47
+ --machine-type="n1-standard-4" \
48
+ --accelerator="count=1,type=nvidia-tesla-t4" \
49
+ --service-account="$_GCP_VERTEX_AI_SA_EMAIL"