-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·39 lines (28 loc) · 1.29 KB
/
Copy pathdeploy.sh
File metadata and controls
executable file
·39 lines (28 loc) · 1.29 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
#!/bin/bash
# Exit immediately if a command exits with a non-zero status.
set -e
# Load environment variables from .env if it exists
if [ -f .env ]; then
export $(cat .env | grep -v '^#' | xargs)
fi
# Use PROJECT_NAME from env as PROJECT_ID if set
PROJECT_ID=${PROJECT_NAME:-$(gcloud config get-value project)}
REGION=${REGION:-"us-west1"}
REPO_NAME="agent-sandbox-repo"
REGISTRY="${REGION}-docker.pkg.dev/${PROJECT_ID}/${REPO_NAME}"
echo "Creating Artifact Registry repository if it doesn't exist..."
gcloud artifacts repositories create "$REPO_NAME" \
--repository-format=docker \
--location="$REGION" \
--description="Repository for Agent Sandbox demo app" || echo "Repository might already exist or failed to create, continuing..."
echo "Authenticating Docker to Artifact Registry..."
gcloud auth configure-docker "${REGION}-docker.pkg.dev" --quiet
echo "Building Demo Application image..."
docker build -t "${REGISTRY}/demo-app:latest" ./demo-app
echo "Pushing Demo Application image..."
docker push "${REGISTRY}/demo-app:latest"
echo "Building Main Application image..."
docker build -t "${REGISTRY}/main-app:latest" -f main-app/Dockerfile .
echo "Pushing Main Application image..."
docker push "${REGISTRY}/main-app:latest"
echo "Deployment images pushed successfully to ${REGISTRY}"