Skip to content

Commit

Permalink
chore(bin): script to publish docker images correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
amandesai01 committed Sep 9, 2024
1 parent 8534a91 commit 8ec097d
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions bin/publish-docker.sh
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

0 comments on commit 8ec097d

Please sign in to comment.