# terraform-ows-features

1. Create an Amazon Elastic Container Registry with a name such as ows-features
2. Get your docker login
    ```
    aws ecr get-login --no-include-email --region us-east-1
    ```
3. Run the command outputted by step #2
3. Go to the root of your service repo and build the docker image
    ```
    docker build -t ows-features:<COMMIT_HASH> .
    ```
4. Tag your image.
    ```
    docker tag ows-features:<COMMIT_HASH> <YOUR_ACCOUNT_ID>.dkr.ecr.us-east-1.amazonaws.com/<YOUR_REPO_NAME>:<COMMIT_HASH>
    ```
5. Push the image to Amazon Elastic Container Registry
    ```
    docker push <YOUR_ACCOUNT_ID>.dkr.ecr.us-east-1.amazonaws.com/<YOUR_REPO_NAME>:<COMMIT_HASH>
    ```
4. Edit `Dockerrun.aws.json`. You need to change account id, region, and git commit.
5. Zip up your application
    ```
    zip -r ows-features.zip Dockerrun.aws.json
    # Add ebextensions if they exist
    if [ -d ./.ebextensions ]; then
      zip -ur ows-features.zip .ebextensions
    fi
    ```
6. Deploy to Elastic Beanstalk.
    ```
    eb use dev-ows-features --region us-east-1
    eb deploy --label <COMMIT_HASH> --region us-east-1 --timeout 30 --verbose
    ```
