mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 18:50:55 +00:00
update deployment: add alt deployment (#223)
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
steps:
|
||||
# Build the Docker image
|
||||
- name: "gcr.io/cloud-builders/docker"
|
||||
args:
|
||||
[
|
||||
"build",
|
||||
"-t",
|
||||
"us-central1-docker.pkg.dev/$PROJECT_ID/openfrontio/game-server:${TAG_NAME}-${SHORT_SHA}",
|
||||
"--build-arg",
|
||||
"GAME_ENV=${_GAME_ENV}",
|
||||
".",
|
||||
]
|
||||
# Push the image to Artifact Registry
|
||||
- name: "gcr.io/cloud-builders/docker"
|
||||
args:
|
||||
[
|
||||
"push",
|
||||
"us-central1-docker.pkg.dev/$PROJECT_ID/openfrontio/game-server:${TAG_NAME}-${SHORT_SHA}",
|
||||
]
|
||||
# Update the GCE instance with the new container image
|
||||
- name: "gcr.io/cloud-builders/gcloud"
|
||||
args:
|
||||
- "compute"
|
||||
- "instances"
|
||||
- "update-container"
|
||||
- "${_INSTANCE_NAME}"
|
||||
- "--container-image"
|
||||
- "us-central1-docker.pkg.dev/$PROJECT_ID/openfrontio/game-server:${TAG_NAME}-${SHORT_SHA}"
|
||||
- "--zone=us-central1-a"
|
||||
substitutions:
|
||||
_INSTANCE_NAME: "openfrontio-dev-instance"
|
||||
_GAME_ENV: "preprod" # Default to preprod
|
||||
TAG_NAME: "dev"
|
||||
options:
|
||||
substitutionOption: "ALLOW_LOOSE"
|
||||
logging: CLOUD_LOGGING_ONLY
|
||||
images:
|
||||
- "us-central1-docker.pkg.dev/$PROJECT_ID/openfrontio/game-server:${TAG_NAME}-${SHORT_SHA}"
|
||||
@@ -21,9 +21,9 @@ if [ -f .env ]; then
|
||||
fi
|
||||
|
||||
# Check command line argument
|
||||
if [ $# -ne 1 ] || ([ "$1" != "staging" ] && [ "$1" != "prod" ]); then
|
||||
echo "Error: Please specify environment (staging or prod)"
|
||||
echo "Usage: $0 [staging|prod]"
|
||||
if [ $# -ne 1 ] || ([ "$1" != "staging" ] && [ "$1" != "prod" ] && [ "$1" != "alt" ]); then
|
||||
echo "Error: Please specify environment (staging, prod, or alt)"
|
||||
echo "Usage: $0 [staging|prod|alt]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -39,6 +39,11 @@ if [ "$ENV" == "staging" ]; then
|
||||
print_header "DEPLOYING TO STAGING ENVIRONMENT"
|
||||
SERVER_HOST=$SERVER_HOST_STAGING
|
||||
DOCKER_REPO=$DOCKER_REPO_STAGING
|
||||
elif [ "$ENV" == "alt" ]; then
|
||||
print_header "DEPLOYING TO ALT ENVIRONMENT"
|
||||
SERVER_HOST=$SERVER_HOST_ALT
|
||||
DOCKER_REPO=$DOCKER_REPO_PROD # Uses prod Docker repo for alt environment
|
||||
ENV="prod"
|
||||
else
|
||||
print_header "DEPLOYING TO PRODUCTION ENVIRONMENT"
|
||||
SERVER_HOST=$SERVER_HOST_PROD
|
||||
|
||||
Reference in New Issue
Block a user