box: wercker-labs/docker
build:
  steps:
    - script:
        name: Build and package the Docker image
        code: |
          cd $WERCKER_SOURCE_DIR
          sudo docker build -t evandbrown/eb-py-flask .
          CONTAINER_ID=$(sudo docker run -d evandbrown/eb-py-flask)
          sudo docker export $CONTAINER_ID > container.tar
          DATETIME=`date +%s`
          tar -cvzf $WERCKER_OUTPUT_DIR/$WERCKER_GIT_COMMIT.tgz container.tar Docker.mf
deploy:
  steps:
    - install-packages:
        packages: python-pip
    - pip-install:
        requirements_file: ""
        packages_list: "awscli"
    - script:
        name: Synchronize build output to S3
        code: |
          aws s3 cp $WERCKER_GIT_COMMIT.tgz s3://$DEPLOY_BUCKET/$WERCKER_GIT_REPOSITORY/$WERCKER_GIT_BRANCH/
      
box: wercker-labs/docker
build:
  steps:
    - script:
        name: Build and package the Docker image
        code: |
          cd $WERCKER_SOURCE_DIR
          sudo docker build -t evandbrown/eb-py-flask .
          CONTAINER_ID=$(sudo docker run -d evandbrown/eb-py-flask)
          sudo docker export $CONTAINER_ID > container.tar
          DATETIME=`date +%s`
          tar -cvzf $WERCKER_OUTPUT_DIR/$WERCKER_GIT_COMMIT.tgz container.tar Docker.mf
deploy:
  steps:
    - install-packages:
        packages: python-pip
    - pip-install:
        requirements_file: ""
        packages_list: "awscli"
    - script:
        name: Synchronize build output to S3
        code: |
          aws s3 cp $WERCKER_GIT_COMMIT.tgz s3://$DEPLOY_BUCKET/$WERCKER_GIT_REPOSITORY/$WERCKER_GIT_BRANCH/
    - script:
        name: Create Elastic Beanstalk Application Version
        code: |
          aws elasticbeanstalk create-application-version \
            --application-name $WERCKER_GIT_REPOSITORY \
            --version-label $WERCKER_GIT_COMMIT-`date +%s` \
            --source-bundle S3Bucket=$DEPLOY_BUCKET,S3Key=$WERCKER_GIT_REPOSITORY/$WERCKER_GIT_BRANCH/$WERCKER_GIT_COMMIT.tgz
      
Create EB App Version in deploy pipeline
Create EB App Version in deploy pipeline
