This project involves creating a machine learning model for salary prediction, Dockerizing the application, and deploying it automatically using Google Cloud Build triggers.
- Project Overview
- Prerequisites
- Model Creation
- Dockerizing the Model
- Creating the Kubernetes Cluster
- Setting Up Google Cloud Build
- Setting Up Cloud Build Trigger
- Testing the Deployment
- Screenshots
The goal of this project is to build a salary prediction model, encapsulate it in a Docker container, and set up a continuous integration and deployment (CI/CD) pipeline using Google Cloud Build and Google Cloud Deploy. This setup ensures that your model is automatically built, tested, and deployed to a Kubernetes cluster whenever changes are made.
Before you begin, ensure you have the following:
- Google Cloud account with billing enabled.
- Google Cloud SDK installed.
- Docker installed.
- Access to Google Artifact Registry for storing Docker images.
- A Kubernetes cluster set up in Google Kubernetes Engine (GKE).
Create a machine learning model that predicts salaries based on year of experience. Save the model. Then create a flask app that takes the year of experience as request and provided the salary prediction as response.
Create a Dockerfile that specifies the environment and dependencies needed to run your model.
Before deploying your application, you'll need to create a Kubernetes cluster in Google Kubernetes Engine (GKE).
To set up Google Cloud Build, you need to create a cloudbuild.yaml
file that defines the steps for building and pushing the Docker image to Google Artifact Registry, deploying the application using Google Cloud Deploy, and releasing it using Skaffold. The build process can be automated using Cloud Build triggers.
To set up a Cloud Build trigger, navigate to the Cloud Build section in the Google Cloud Console and create a trigger linked to your source repository. This trigger will automatically build and deploy the Docker image whenever changes are pushed to the specified branch.
Here are some screenshots to illustrate the process: