Create a new environment
py -3.7 -m venv venv
Activate the venv environment that was created
venv\Scripts\activate
Tagged Docker image correctly to match the Heroku container registry format:
docker tag <image_name> registry.heroku.com/<app_name>/web
Instead of pushing with docker push, we used Heroku’s container CLI commands to ensure proper build and release:
heroku container:push web --app <app_name>
heroku container:release web --app <app_name>
Avoided using exec form with $PORT which doesn't expand environment variables.
- Correct shell form used in Dockerfile:
CMD gunicorn --workers=4 --bind 0.0.0.0:$PORT app:app
Monitored Heroku logs to identify runtime errors and crashes:
heroku logs --tail --app <app_name>
This helped to catch the $PORT substitution issue and fix it.
- Flask app was properly configured in app.py.
- Dependencies listed correctly in requirements.txt.
- Dockerfile used a compatible base image (python:3.7) with no build errors.