This repository was archived by the owner on Apr 1, 2026. It is now read-only.
forked from datalab-to/marker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudbuild.yaml
More file actions
64 lines (58 loc) · 2.35 KB
/
Copy pathcloudbuild.yaml
File metadata and controls
64 lines (58 loc) · 2.35 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
steps:
# Build the container image
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'us-east1-docker.pkg.dev/$PROJECT_ID/cloud-run-source-deploy/marker-gpu-api:latest', '-f', 'Dockerfile.gpu', '.']
# Push the container image to Container Registry
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'us-east1-docker.pkg.dev/$PROJECT_ID/cloud-run-source-deploy/marker-gpu-api:latest']
# Create a Compute Engine instance with GPU
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
args:
- '-c'
- |
gcloud compute instances create marker-gpu-instance \
--project=$PROJECT_ID \
--zone=us-east1-b \
--machine-type=n1-standard-4 \
--network-interface=network-tier=PREMIUM,subnet=default \
--maintenance-policy=TERMINATE \
--provisioning-model=STANDARD \
--service-account=795058584669-compute@developer.gserviceaccount.com \
--scopes=https://www.googleapis.com/auth/cloud-platform \
--accelerator=count=1,type=nvidia-tesla-t4 \
--tags=http-server,https-server \
--create-disk=auto-delete=yes,boot=yes,device-name=marker-gpu-instance,image=projects/cos-cloud/global/images/cos-stable-109-17800-147-15,mode=rw,size=50,type=pd-balanced \
--no-shielded-secure-boot \
--shielded-vtpm \
--shielded-integrity-monitoring \
--reservation-affinity=any \
--metadata=startup-script="#! /bin/bash
# Install NVIDIA drivers
cos-extensions install gpu
mount -o remount,exec /var/lib/nvidia
/var/lib/nvidia/bin/nvidia-smi
# Pull and run the marker-api container
docker pull us-east1-docker.pkg.dev/$PROJECT_ID/cloud-run-source-deploy/marker-gpu-api:latest
docker run -d --gpus all -p 80:8080 \
-e PORT=8080 \
-e GOOGLE_CLOUD_PROJECT=$PROJECT_ID \
us-east1-docker.pkg.dev/$PROJECT_ID/cloud-run-source-deploy/marker-gpu-api:latest
"
# Create firewall rule to allow HTTP traffic
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
args:
- '-c'
- |
gcloud compute firewall-rules create allow-http \
--direction=INGRESS \
--priority=1000 \
--network=default \
--action=ALLOW \
--rules=tcp:80 \
--source-ranges=0.0.0.0/0 \
--target-tags=http-server || echo "Firewall rule already exists"
# No substitutions needed as we're using PROJECT_ID directly
options:
logging: CLOUD_LOGGING_ONLY