forked from trainindata/deploying-machine-learning-models
/
Makefile
29 lines (21 loc) · 1.16 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Command to build the Docker image
# The image name is specified by the `-t` option, including:
# - hub location (Heroku registry)
# - image name (the app's name). Note that no tag is specified, so it will be "latest"
build-ml-api-heroku:
docker build --build-arg KAGGLE_USERNAME=$(KAGGLE_USERNAME) --build-arg KAGGLE_KEY=$(KAGGLE_KEY) -t registry.heroku.com/$(HEROKU_APP_NAME)/web .
# This command is of the form: docker push registry.heroku.com/<app>/<process-type>
push-ml-api-heroku:
docker push registry.heroku.com/$(HEROKU_APP_NAME)/web:latest
# ----------------------
# Deploying to AWS
# (I have not done this, so these commands are not run, just for documentation)
AWS_ACCOUNT_ID=None
TAG_OR_COMMIT_ID=$(shell git describe --tags --always HEAD)
# Alternatively, to get the (short) SHA: git rev-parse --short HEAD
build-ml-api-aws:
docker build --build-arg PIP_EXTRA_INDEX_URL=${PIP_EXTRA_INDEX_URL} -t $(NAME):$(TAG_OR_COMMIT_ID) .
push-ml-api-aws:
docker push ${AWS_ACCOUNT_ID}.dkr.ecr.us-east-1.amazonaws.com/$(NAME):$(TAG_OR_COMMIT_ID)
tag-ml-api:
docker tag $(NAME):$(TAG_OR_COMMIT_ID) ${AWS_ACCOUNT_ID}.dkr.ecr.us-east-1.amazonaws.com/$(NAME):$(TAG_OR_COMMIT_ID)