The project contains a pre-trained, sklearn
model that has been trained to predict housing prices in Boston according to several features, such as average rooms in a home and data about highway access, teacher-to-pupil ratios, and so on. You can read more about the data, which was initially taken from Kaggle, on the data source site. It serves out predictions (inference) about housing prices through API calls. This project could be extended to any pre-trained machine learning model, such as those for image recognition and data labeling.
The project uses Docker for containerization and Kubernetes for container orchestration
Setting Up the Environment
-
Standalone
- Ensure python 3.7 is available in the host machine
- Install venv
- Create the virtual environment for the project
- Activate the environment
- Install the app's dependencies by running:
make install
-
Docker
- Set up and configure Docker
- (Optional) Install hadolint to lint the Dockerfile
-
Kubernetes
- Set up and configure Docker
- Set up and configure Kubernetes (minikube and Kubectl used in this project)
- Create a containerized Flask application
Commands
- Standalone:
python app.py
- Run in Docker:
./run_docker.sh
- Run in Kubernetes:
./run_kubernetes.sh
app.py
- flask application that returns the predictionsrequirements.txt
- contains the app's dependenciesMakefile
- contains commands to easily setup a virtual environment, install dependencies, and lint filesDockerfile
- contains instructions on how to build a docker imagerun_docker.sh
- builds the docker image, tags it, and runs the containerupload_docker.sh
- tags the docker image and pushes it to a repositoryrun_kubernetes.sh
- runs the application in kubernetesmake_prediciton.sh
- sends a request to the app for predictiondocker_out.txt
- contains sample output of a successful response after runningmake_prediciton.sh
with a successfully running container applicationkubernetes_out.txt
- contains sample output of successful response after runningmake_prediciton.sh
with a successfully running application in kubernetes.circleci/config.yml
- CircleCI config file to build the app