diff --git a/docker/beta/build.sh b/docker/beta/build.sh index c6b71f0..6fd9747 100644 --- a/docker/beta/build.sh +++ b/docker/beta/build.sh @@ -1,12 +1,31 @@ #!/bin/bash +set -e -# Build the image +# Build the image locally first docker build . -t reverse-proxy:latest + +# Tag as required docker tag reverse-proxy:latest 805875567437.dkr.ecr.us-west-1.amazonaws.com/reverse-proxy:latest -# ECR Authentication -aws ecr get-login-password --region us-west-1 | docker login --username AWS --password-stdin 805875567437.dkr.ecr.us-west-1.amazonaws.com +if [ "$1" = "dev" ]; then + ########################### + # Development build steps + ########################### + echo "Building local dev image" + echo "Skipping docker push because this is a local build" +elif [ "$1" = "prod" ]; then + ########################### + # Production build steps + ########################### + echo "Building production image" + echo "Authenticating to push to production registry" + # ECR Authentication + aws ecr get-login-password --region us-west-1 | docker login --username AWS --password-stdin 805875567437.dkr.ecr.us-west-1.amazonaws.com + # Pushing tagged image + docker push 805875567437.dkr.ecr.us-west-1.amazonaws.com/reverse-proxy:latest +else + echo "Unknown option given to build.sh" + exit 1 +fi -# Pushing tagged image -docker push 805875567437.dkr.ecr.us-west-1.amazonaws.com/reverse-proxy:latest diff --git a/docker/beta/run.sh b/docker/beta/run.sh index 2f02076..7b447e5 100644 --- a/docker/beta/run.sh +++ b/docker/beta/run.sh @@ -1,9 +1,8 @@ #!/bin/bash +set -e + +# This script is used for running the image locally for testing purposes + docker run --publish 80:80 --name gateway --rm \ - -e S3_ACCESS_KEY_ID="$(pass dev/project-athens-admin/key_id)" \ - -e S3_SECRET_KEY="$(pass dev/project-athens-admin/secret)" \ - -e S3_REGION=us-west-1 \ - -e S3_SERVER=s3-us-west-1.amazonaws.com \ - -e S3_BUCKET_NAME=shockrah-xyz-static-content \ - reverse-proxy + 805875567437.dkr.ecr.us-west-1.amazonaws.com/reverse-proxy:latest