Skip to content

Setup Your Project

Jun Zheng edited this page Dec 6, 2017 · 1 revision

There are some required steps you have to take in order to deploy your application.

  1. Your application must be Dockerized.

  2. Add a buildspec.yml to your project.

version: 0.2

phases:
  pre_build:
    commands:
      - echo Logging in to Amazon ECR...
      - $(aws ecr get-login --region $AWS_DEFAULT_REGION)
  build:
    commands:
      - echo Build started on `date`
      - echo Building the Docker image...  
      - aws s3 cp s3://bucket/file /dest        
      - docker build -t $IMAGE_REPO_NAME:latest .
      - docker tag $IMAGE_REPO_NAME:$IMAGE_TAG $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG      
  post_build:
    commands:
      - echo Build completed on `date`
      - echo Pushing the Docker image...
      - docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG

Take note of line aws s3 cp s3://bucket/file /dest, this is where you download secrets, upload your secret file to S3 container, then simply pull from there. Do not modify $XXXXXX parameters, they will be provided by operations team upon build.

You are done, contact operations team to setup your build & deployment pipeline.

Clone this wiki locally