-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding publish scripts for publishing docker containers to ECR. (#83)
- Loading branch information
1 parent
2c34473
commit 07d1ab8
Showing
3 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Docker | ||
This directory contains necessary scripts to build and publish each of our docker containers to AWS ECR. | ||
|
||
## Publish scripts | ||
The `AWS_ACCOUNT_NUMBER` environment variable will need to be set in order to use these scripts. It's recommended to just add this to your profile. | ||
|
||
The only parameter is an optional tag name. If no tag is specified, `latest` will be used. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/sh | ||
# Publish Geth Container | ||
# Optional 1st argument is tag name. Default is 'latest'. | ||
|
||
set -e | ||
|
||
if [ $# -eq 1 ]; then | ||
GETH_TAG=$1 | ||
echo "Found tag '$GETH_TAG'. Using this as the container tag." | ||
fi | ||
|
||
BASE_DIR=$(dirname $0) | ||
TAG=${GETH_TAG:-latest} | ||
|
||
if [ -z "$AWS_ACCOUNT_NUMBER" ]; then | ||
echo "No AWS_ACCOUNT_NUMBER env variable is set. Please set it to use this script." | ||
exit 1 | ||
fi | ||
|
||
echo "\nAuthenticating within ECR...\n" | ||
aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin "$AWS_ACCOUNT_NUMBER.dkr.ecr.us-east-2.amazonaws.com/optimism/geth" | ||
|
||
echo "\nBuilding Geth container...\n" | ||
docker build -t optimism/geth "$BASE_DIR/geth/." | ||
|
||
echo "\nTagging Geth container as $TAG...\n" | ||
docker tag optimism/geth:latest "$AWS_ACCOUNT_NUMBER.dkr.ecr.us-east-2.amazonaws.com/optimism/geth:$TAG" | ||
|
||
echo "\nPushing Geth container to ECR...\n" | ||
docker push "$AWS_ACCOUNT_NUMBER.dkr.ecr.us-east-2.amazonaws.com/optimism/geth:$TAG" | ||
|
||
echo "\nPublish complete!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/sh | ||
# Publish Rollup Fullnode Container | ||
# Optional 1st argument is tag name. Default is 'latest'. | ||
|
||
set -e | ||
|
||
if [ $# -eq 1 ]; then | ||
FULLNODE_TAG=$1 | ||
echo "Found tag '$FULLNODE_TAG'. Using this as the container tag." | ||
fi | ||
|
||
SCRIPT_DIR=$(dirname $0) | ||
ROOT_DIR=$SCRIPT_DIR/.. | ||
|
||
TAG=${FULLNODE_TAG:-latest} | ||
|
||
if [ -z "$AWS_ACCOUNT_NUMBER" ]; then | ||
echo "No AWS_ACCOUNT_NUMBER env variable is set. Please set it to use this script." | ||
exit 1 | ||
fi | ||
|
||
# Make sure we build so the container is using the current source | ||
yarn --cwd $ROOT_DIR clean && yarn --cwd $ROOT_DIR build | ||
|
||
echo "\nAuthenticating within ECR...\n" | ||
aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin "$AWS_ACCOUNT_NUMBER.dkr.ecr.us-east-2.amazonaws.com/optimism/rollup-full-node" | ||
|
||
echo "\nBuilding fullnode container...\n" | ||
docker build -t optimism/rollup-full-node "$ROOT_DIR" | ||
|
||
echo "\nTagging fullnode container as $TAG in ECR...\n" | ||
docker tag optimism/rollup-full-node:latest "$AWS_ACCOUNT_NUMBER.dkr.ecr.us-east-2.amazonaws.com/optimism/rollup-full-node:$TAG" | ||
|
||
echo "\nPushing fullnode container to ECR...\n" | ||
docker push "$AWS_ACCOUNT_NUMBER.dkr.ecr.us-east-2.amazonaws.com/optimism/rollup-full-node:$TAG" | ||
|
||
echo "\nPublish complete!" |