Skip to content
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
106 changes: 52 additions & 54 deletions .github/workflows/dev-ecr-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,53 @@
# TODO: Uncomment when Dev works
#name: Build & Tag Container, Push to ECR, Deploy to Dev
#
#on:
# push:
# branches:
# - master
#
#jobs:
# build:
# name: Build, Tag & push to ECR, Deploy task
# runs-on: ubuntu-latest
#
# steps:
# - uses: actions/checkout@v2
# - name: Setup node
# uses: actions/setup-node@v1
#
# - name: Install Dependencies
# run: yarn install
#
# - name: Build
name: Build & Tag Container, Push to ECR, Deploy to Dev

on:
push:
branches:
- master

jobs:
build:
name: Build, Tag & push to ECR, Deploy task
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v1

- name: Install Dependencies
run: yarn install

- name: Build
run: |
yarn clean
yarn build

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_CI_USER_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_CI_USER_SECRET_ACCESS_KEY }}
aws-region: us-east-2

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: optimism/rollup-microservices
IMAGE_TAG: latest
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG

# TODO: Add this when the DEV env is set up
# - name: Stop existing dev-rollup-microservices ECS task to auto-start task with new image
# run: |
# yarn clean
# yarn build
#
# - name: Configure AWS Credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_CI_USER_ACCESS_KEY_ID }}
# aws-secret-access-key: ${{ secrets.AWS_CI_USER_SECRET_ACCESS_KEY }}
# aws-region: us-east-2
#
# - name: Login to Amazon ECR
# id: login-ecr
# uses: aws-actions/amazon-ecr-login@v1
#
# - name: Build, tag, and push image to Amazon ECR
# env:
# ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
# ECR_REPOSITORY: optimism/rollup-full-node
# IMAGE_TAG: latest
# run: |
# docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
# docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
#
# - name: Stop existing dev-rollup-full-node ECS task to auto-start task with new image
# run: |
# ./.github/scripts/stop-ecs-task.sh dev-full-node full-node
# ./.github/scripts/stop-ecs-task.sh synthetix-dev-full-node full-node
#
#
# - name: Logout of Amazon ECR
# if: always()
# run: docker logout ${{ steps.login-ecr.outputs.registry }}
# ./.github/scripts/stop-ecs-task.sh dev-rollup-microservices rollup-microservices

- name: Logout of Amazon ECR
if: always()
run: docker logout ${{ steps.login-ecr.outputs.registry }}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
- l2-node-data:/mnt/l2-node:rw
build:
context: .
dockerfile: Dockerfile.services
dockerfile: Dockerfile.microservices
environment:
# Logging
- DEBUG=info*,error*,warn*,debug* # The comma-separated logging patterns to match (common options are `error*`, `info*`, `warn*`, and `debug*`)
Expand Down
37 changes: 37 additions & 0 deletions docker/publish-rollup-microservices-container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/sh
# Publish Rollup Microservices Container
# Optional 1st argument is tag name. Default is 'latest'.

set -e

if [ $# -eq 1 ]; then
MICROSERVICES_TAG=$1
echo "Found tag '$MICROSERVICES_TAG'. Using this as the container tag."
fi

SCRIPT_DIR=$(dirname $0)
ROOT_DIR=$SCRIPT_DIR/..

TAG=${MICROSERVICES_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-microservices"

echo "\nBuilding Microservices container...\n"
docker build -f "$ROOT_DIR/Dockerfile.microservices" -t "optimism/rollup-microservices:$TAG" "$ROOT_DIR"

echo "\nTagging Microservices container as $TAG in ECR...\n"
docker tag "optimism/rollup-microservices:$TAG" "$AWS_ACCOUNT_NUMBER.dkr.ecr.us-east-2.amazonaws.com/optimism/rollup-microservices:$TAG"

echo "\nPushing Microservices container to ECR...\n"
docker push "$AWS_ACCOUNT_NUMBER.dkr.ecr.us-east-2.amazonaws.com/optimism/rollup-microservices:$TAG"

echo "\nPublish complete!"