Skip to content

Commit

Permalink
Added option to speicy a registry id
Browse files Browse the repository at this point in the history
  • Loading branch information
toneill-newinnov committed Jun 27, 2018
1 parent 35b8206 commit 3f1c12d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ AWS_KEY
AWS_SECRET
REGION
RENEW_TOKEN - default 6h
REGISTRY_ID - optional, used for cross account access
```

### Health check

To check the health of the container/registry use ```FQDN/ping``` which will give you the heath of the registry with the correct status code.
Expand Down
7 changes: 6 additions & 1 deletion configs/auth_update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ nx_conf=/etc/nginx/nginx.conf

# update the auth token
auth=$(grep X-Forwarded-User ${nx_conf} | awk '{print $4}'| uniq|tr -d "\n\r")
token=$(aws ecr get-login --no-include-email | awk '{print $6}')
if [ "$REGISTRY_ID" = "" ]
then
token=$(aws ecr get-login --no-include-email | awk '{print $6}')
else
aws_cli_exec=$(aws ecr get-login --no-include-email --registry-ids $REGISTRY_ID)
fi
auth_n=$(echo AWS:${token} | base64 |tr -d "[:space:]")

sed -i "s|${auth%??}|${auth_n}|g" ${nx_conf}
7 changes: 6 additions & 1 deletion configs/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ else
fi

# update the auth token
aws_cli_exec=$(aws ecr get-login --no-include-email)
if [ "$REGISTRY_ID" = "" ]
then
aws_cli_exec=$(aws ecr get-login --no-include-email)
else
aws_cli_exec=$(aws ecr get-login --no-include-email --registry-ids $REGISTRY_ID)
fi
auth=$(grep X-Forwarded-User ${nx_conf} | awk '{print $4}'| uniq|tr -d "\n\r")
token=$(echo "${aws_cli_exec}" | awk '{print $6}')
auth_n=$(echo AWS:${token} | base64 |tr -d "[:space:]")
Expand Down

0 comments on commit 3f1c12d

Please sign in to comment.