conda create -p venv python==3.11 -y
conda activate venv/
Create a requirements.txt
file add all the libraries required and install them
pip install -r requirements.txt
Now, we create the flask app file as app.py
and write our code in it, and then run the app
python app.py
To add the file in the git repo
git add <filename>
or
git add .
Note: If there are some files in our folder that we do not want to track or do versioning then we add them to the
.gitignore
file
To check the git status
git status
To check all the versions maintained by git
git log
To create a new version/commit all the changes by git
git commit -m "your comment/message"
To send version/changes to the GitHub
git push origin main
To check remote URl from where the files will be pushed or pulled
git remote -v
To setup CI/CD pipeline in Heroku we need 3 information:
- HEROKU_EMAIL = sr.shahlal@gmail.com
- HEROKU_API_Key = <>
- HEROKU_APP_Name = ml-ete-app
docker build -t <image_name>:<tagname> .
Note: The image name for docker must be lowercase
To list the docker image
docker images
Run docker image
docker run -p 5000:5000 -e PORT=5000 b3bb833287a8
To check the running container in the docker
docker ps
To stop the docker container
docker stop <container_id>
- Create a
.github
folder and inside the folder add another folderworkflows
in this workflows folder create a filemain.yaml
main.yaml
file write the GitHub action flow- push the change to the git repo
- open the repo in GitHub and go to setting/secrets/actions and create New repository secret for all the secrets that have been mentioned in the
main.yaml
file and save themNote: That the
Name*
andSecret*
is same as mentioned - once this is done our deployment will take place automatically which we can see in the actions tab in the GitHub repo
Now whenever there is any push to the repo it will automatically trigger the deployment in the heroku web app
Moving ahead we will add a setup.py
file and a folder housing
that we'll contain a file inside it which has to be created as __init__.py
Now we will write the setup coed in our setup.py
file and run it
python setup.py install
Note: this will generate
build
,dist
andhousing_predictor.egg-info
based on what values we have passed in thesetup.py
I have created a create_folders.py
file which has a list of folders we want to create once we run that file it will automatically create all the folders that we want to create under the housing
folder.