Skip to content

Instantly share code, notes, and snippets.

@mpetrunic
Created September 20, 2018 07:20
Show Gist options
  • Select an option

  • Save mpetrunic/d2c813be65c48e7017a315dce1b951bd to your computer and use it in GitHub Desktop.

Select an option

Save mpetrunic/d2c813be65c48e7017a315dce1b951bd to your computer and use it in GitHub Desktop.
deploy:
working_directory: ~/app
machine:
image: circleci/classic:latest
steps:
- checkout
- attach_workspace:
at: ./
- run:
name: Load Docker images
command: |
set +o pipefail
docker load -i ./image.tar || true
- run:
name: Build production image
command: docker build -t final -f Dockerfile.production .
- run:
name: Install dependencies
command: |
sudo apt-get -y -qq update
sudo apt-get -y -qq install python3.4-dev
curl -O https://bootstrap.pypa.io/get-pip.py
python3.4 get-pip.py --user
~/.local/bin/pip install awscli --upgrade --user
- deploy:
name: ECR Docker Package and Push
environment:
- AWS_ECR_URL: something.dkr.ecr.us-west-2.amazonaws.com
- AWS_REGION: us-west-2
command: |
~/.local/bin/aws configure set region $AWS_REGION
login="$(~/.local/bin/aws ecr get-login --no-include-email)"
${login}
docker tag final ${AWS_ECR_URL}/node-ts-starter:latest
docker tag final ${AWS_ECR_URL}/node-ts-starter:${CIRCLE_SHA1}
docker push ${AWS_ECR_URL}/node-ts-starter:${CIRCLE_SHA1}
docker push ${AWS_ECR_URL}/node-ts-starter:latest
- run:
name: Update staging custer service
environment:
- AWS_REGION: us-west-2
command: ~/.local/bin/aws ecs update-service --cluster cluster-name --service node-ts-starter-service --force-new-deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment