-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
upload
executable file
·31 lines (20 loc) · 949 Bytes
/
upload
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
#
# Upload a TAKServer Docker image to the correct ECR
#
# Drop preceding folders & remove extension
folder=$(basename -- "$1")
folder=${folder%.*}
if [[ ! "${folder:0:17}" == "takserver-docker-" ]]; then
echo "Error: takserver-docker must start with takserver-docker-" >&2
exit 1
fi
set -euo pipefail
unzip -o $1 -d /tmp/
echo "Extracted /tmp/${folder}"
VERSION=$(echo $folder | sed 's/takserver-docker-//' | tr '[:upper:]' '[:lower:]')
docker build -t takserver:${VERSION} .
AWS_ACCOUNT=$(aws sts get-caller-identity --query Account --output text)
aws ecr get-login-password --region ${AWS_DEFAULT_REGION} | docker login --username AWS --password-stdin ${AWS_ACCOUNT}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com
docker tag takserver:${VERSION} ${AWS_ACCOUNT}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/coe-ecr-tak:${VERSION}
docker push ${AWS_ACCOUNT}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/coe-ecr-tak:${VERSION}