Skip to content

Commit

Permalink
Section 11.5 - Using Docker with Heroku
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherGS committed Oct 14, 2019
1 parent 4314c6e commit c25e909
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
29 changes: 28 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,26 @@ jobs:
name: Deploy to Heroku
command: |
git push https://heroku:[email protected]/$HEROKU_APP_NAME.git master
section_11_build_and_push_to_heroku_docker:
<<: *defaults
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
- run: docker login --username=$HEROKU_EMAIL --password=$HEROKU_API_KEY registry.heroku.com
- run:
name: Setup Heroku CLI
command: |
wget -qO- https://cli-assets.heroku.com/install-ubuntu.sh | sh
- run:
name: Build and Push Image
command: |
make build-ml-api-heroku push-ml-api-heroku
- run:
name: Release to Heroku
command: |
heroku container:release web --app $HEROKU_APP_NAME
workflows:
version: 2
Expand All @@ -130,7 +150,14 @@ workflows:
branches:
only:
- master
- section_10_deploy_to_heroku:
# - section_10_deploy_to_heroku:
# requires:
# - train_and_upload_regression_model
# filters:
# branches:
# only:
# - master
- section_11_build_and_push_to_heroku_docker:
requires:
- train_and_upload_regression_model
filters:
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
NAME=udemy-ml-api
COMMIT_ID=$(shell git rev-parse HEAD)


build-ml-api-heroku:
docker build --build-arg PIP_EXTRA_INDEX_URL=${PIP_EXTRA_INDEX_URL} -t registry.heroku.com/$(NAME)/web:$(COMMIT_ID) .

push-ml-api-heroku:
docker push registry.heroku.com/${HEROKU_APP_NAME}/web:$(COMMIT_ID)

0 comments on commit c25e909

Please sign in to comment.