This project demonstrates the process of containerizing a machine learning microservice using docker and deploying this microservice via kubernetes.
application
- contains files related to microserviceDockerfile
Makefile
app.py
requirements.txt
model_data
scripts
make_prediction.sh
- script to test microservice deploymentrun_docker.sh
- script to build docker image and run image on docker locallyrun_kubernetes.sh
- script to deploy docker image on to a kubernetes clusterupload_docker.sh
- script to upload newly created docker image
.circleci
config.yml
- contains circleci ci/cd configuration to run build tests
output_txt_files
docker_out.txt
- example output from running prediction on microservice on local dockerkubernetes_out.txt
- example output from running prediction on microservice on kubernetes
The following steps require the following environment variables to be set. (Alternatively, these variables can be directly substituted within the scripts themselves)
DOCKERPATH
- path to docker image (ex: repo/name:tag)USERNAME
- dockerhub usernamePASSWORD
- dockerhub passwordIMAGE_ID
- image id after building docker image runningrun_docker.sh
- Change working directory to
scripts
folder - Run
./run_docker.sh
- Run
./upload_docker.sh
- Optional: Run
./make_prediction.sh
to test microservice running locally in docker - Run
./run_kubernetes.sh
- Optional: Run
./make_prediction.sh
to test microservice running on kubernetes