Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding publish scripts for publishing docker containers to ECR. #83

Merged
merged 1 commit into from
Apr 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docker/README.md
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.
32 changes: 32 additions & 0 deletions docker/publish-geth-container.sh
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!"
37 changes: 37 additions & 0 deletions docker/publish-rollup-fullnode-container.sh
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!"