Sample flask Docker Compose project with heroku deployment configuration
$ docker-compose buildFlask-Migrate and Flask-SQLAlchemy are used to manage db schema and migrations.
$ docker-compose run web_app flask db upgradeThe command may fail on the first try if the database container is slow to boot up. If it failed, simply rerun the command again. Alternatively you can use this command instead:
$ docker-compose run web_app ./wait-for-pg.sh db flask db upgrade$ docker-compose upThis will run the flask development web server for web_app/app.py
The default runs on port 5000 by default for development. Open localhost:5000 on the browser to view the app.
You can now start adding code to app.py. The flask development web server is configure to reload on code change.
Hit CTRL-C to exit.
Uses pipenv to manage depency versions but not for virtual environments.
$ docker-compose run web_app pipenv install [package]We still need to rebuild the image if we installed a dependency:
$ docker-compose buildSee official Docs: https://devcenter.heroku.com/articles/heroku-cli
If you did not clone this repo, make sure to have git initialized on the root directory (where heroku.yml lives).
Commit your changes to Git.
$ git add .
$ git commit -m "Commit message"
Upgrade to heroku-cli beta and install plugin-manifest
$ heroku update beta
$ heroku plugins:install @heroku-cli/plugin-manifestCreate the heroku app
$ heroku create [your-app-name] --manifestDeploy the app via git
$ git push heroku masterThis will rebuild the docker image and deploy it to heroku. It may take while to complete the rebuild.
$ heroku open