deploy-docker.sh 818 Bytes
Newer Older
Rayan  CHIKHI's avatar
Rayan CHIKHI committed
1 2 3 4 5 6 7
#!/bin/bash
cd src
ACCOUNT=$(aws sts get-caller-identity --query Account --output text) # AWS ACCOUNT ID
DOCKER_CONTAINER=aws-batch-s3-unitigs-job
REPO=${ACCOUNT}.dkr.ecr.us-east-1.amazonaws.com/${DOCKER_CONTAINER}
TAG=build-$(date -u "+%Y-%m-%d")
echo "Building Docker Image..."
Rayan  CHIKHI's avatar
Rayan CHIKHI committed
8 9 10 11 12
docker build -t $DOCKER_CONTAINER \
             --build-arg AWS_ACCESS_KEY_ID=$(./get-aws-profile.sh --key) \
             --build-arg AWS_SECRET_ACCESS_KEY=$(./get-aws-profile.sh --secret) \
             --build-arg AWS_DEFAULT_REGION=us-east-1 \
              .
Rayan  CHIKHI's avatar
Rayan CHIKHI committed
13 14 15 16 17 18 19
echo "Authenticating against AWS ECR..."
eval $(aws ecr get-login --no-include-email --region us-east-1)
echo "Tagging ${REPO}..."
docker tag $DOCKER_CONTAINER:latest $REPO:$TAG
docker tag $DOCKER_CONTAINER:latest $REPO:latest
echo "Deploying to AWS ECR"
docker push $REPO