-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(bin): script to publish docker images correctly
- Loading branch information
1 parent
8534a91
commit 8ec097d
Showing
1 changed file
with
29 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,29 @@ | ||
#!/bin/bash | ||
|
||
source .env | ||
|
||
VERSION=$(npm pkg get version | tr -d \") | ||
|
||
if [ -z "$VERSION" ]; then | ||
echo "Version not found in package.json" | ||
return | ||
fi | ||
|
||
docker build . -t profilecity/vidur:$VERSION -f infra/Dockerfile.prod | ||
|
||
# Publish to Docker registry | ||
docker tag profilecity/vidur:$VERSION profilecity/vidur:latest | ||
docker push profilecity/vidur:$VERSION | ||
docker push profilecity/vidur:latest | ||
|
||
if [ -z "$ECR_HOST" ]; then | ||
echo "ECR host not found " | ||
return | ||
fi | ||
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin $ECR_HOST | ||
|
||
# Publish to ECR | ||
docker tag profilecity/vidur:$VERSION $ECR_HOST/profilecity/vidur:$VERSION | ||
docker tag profilecity/vidur:latest $ECR_HOST/profilecity/vidur:latest | ||
docker push $ECR_HOST/profilecity/vidur:$VERSION | ||
docker push $ECR_HOST/profilecity/vidur:latest |