-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·43 lines (34 loc) · 1.57 KB
/
deploy.sh
File metadata and controls
executable file
·43 lines (34 loc) · 1.57 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
#!/bin/bash
# This script deploys the Marin Data Browser application to Google Cloud Run.
# It performs the following steps:
# 1. Creates an Artifact Registry repository if it doesn't exist
# 2. Builds the Docker image using production Dockerfile
# 3. Tags and pushes the image to Artifact Registry
# 4. Deploys the application to Cloud Run
# 5. Configures public access to the service
set -e
# Check if repository exists, create only if it doesn't
if ! gcloud artifacts repositories describe marin-data-browser \
--location=us-central1 \
--project=hai-gcp-models >/dev/null 2>&1; then
gcloud artifacts repositories create marin-data-browser \
--repository-format=docker \
--location=us-central1 \
--project=hai-gcp-models
fi
docker build --platform linux/amd64 -t marin-data-browser -f Dockerfile.prod .
gcloud auth configure-docker us-central1-docker.pkg.dev
docker tag marin-data-browser us-central1-docker.pkg.dev/hai-gcp-models/marin-data-browser/marin-data-browser
docker push us-central1-docker.pkg.dev/hai-gcp-models/marin-data-browser/marin-data-browser
gcloud run deploy marin-data-browser \
--image us-central1-docker.pkg.dev/hai-gcp-models/marin-data-browser/marin-data-browser \
--port 80 \
--region us-central1 \
--platform managed \
--ingress all \
--service-account [email protected]
# Allow unauthenticated access to the service
gcloud run services add-iam-policy-binding marin-data-browser \
--region=us-central1 \
--member="allUsers" \
--role="roles/run.invoker"