-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ba8bca
commit 4c9dc40
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
ENV=$1 | ||
VERSION=$2 | ||
|
||
DEV_PROJECT_ID="motrpac-portal-dev" | ||
PROD_PROJECT_ID="motrpac-portal" | ||
|
||
DEV_COMPOSE_FILE="docker-compose.dev.yaml" | ||
PROD_COMPOSE_FILE="docker-compose.yaml" | ||
|
||
function tag_with_latest_and_version() { | ||
project_id=$1 | ||
compose_file=$2 | ||
|
||
docker compose -f "$compose_file" build | ||
docker tag "motrpac-frontend:latest" "us-docker.pkg.dev/$project_id/datahub/frontend:$VERSION" | ||
docker push "us-docker.pkg.dev/$project_id/datahub/frontend:latest" | ||
docker push "us-docker.pkg.dev/$project_id/datahub/frontend:$VERSION" | ||
} | ||
|
||
if [[ $ENV = "dev" ]]; then | ||
tag_with_latest_and_version $DEV_PROJECT_ID $DEV_COMPOSE_FILE | ||
exit 0 | ||
fi | ||
|
||
if [[ $ENV = "prod" ]]; then | ||
tag_with_latest_and_version $PROD_PROJECT_ID $PROD_COMPOSE_FILE | ||
exit 0 | ||
fi | ||
|
||
if [[ $ENV = "both" ]]; then | ||
tag_with_latest_and_version $DEV_PROJECT_ID $DEV_COMPOSE_FILE | ||
tag_with_latest_and_version $PROD_PROJECT_ID $PROD_COMPOSE_FILE | ||
exit 0 | ||
fi | ||
|
||
|
||
echo "Invalid environment. Please use 'dev' or 'prod'." | ||
exit 1 |