-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpush.sh
executable file
·32 lines (24 loc) · 1.01 KB
/
push.sh
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
######################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# SPDX-License-Identifier: MIT-0 #
######################################################################
source .env
# Create registry if needed
REGISTRY_COUNT=$(aws ecr describe-repositories | grep \"${IMAGE}\" | wc -l | tr -d ' ')
if [ "$REGISTRY_COUNT" == "0" ]; then
CMD="aws ecr create-repository --repository-name ${IMAGE}"
if [ ! "$verbose" == "false" ]; then echo -e "\n${CMD}\n"; fi
eval "$CMD"
fi
# Login to registry
./login.sh
CMD="docker image push ${REGISTRY}${IMAGE}${TAG}"
if [ ! "$verbose" == "false" ]; then echo -e "\n${CMD}\n"; fi
eval "$CMD"
CMD="docker image tag ${REGISTRY}${IMAGE}${TAG} ${REGISTRY}${IMAGE}:latest"
if [ ! "$verbose" == "false" ]; then echo -e "\n${CMD}\n"; fi
eval "$CMD"
CMD="docker image push ${REGISTRY}${IMAGE}:latest"
if [ ! "$verbose" == "false" ]; then echo -e "\n${CMD}\n"; fi
eval "$CMD"