
ACCOUNT_ID=727401853962
REGION=us-east-1

VERSION="$1"

if [ -z "$VERSION" ]; then
    echo "Must specify version. Probably 1.0.0"
    exit  1
fi

docker tag "localhost/jamtrack-lambda:1.0.0" "$ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com/jamkazam/jamtrack-lambda:${VERSION}"


aws ecr get-login-password --region $REGION | docker login --username AWS --password-stdin $ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com 
docker push $ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com/jamkazam/jamtrack-lambda:${VERSION} 
aws lambda update-function-code --function-name jamtrack-importer-staging-TencyUnzipFunction-HSAQnacd11Sx --image-uri 727401853962.dkr.ecr.us-east-1.amazonaws.com/jamkazam/jamtrack-lambda:1.0.0
