Deploy Flask's Docker image on Heroku

Deploy Flask's Docker image on Heroku

Introduction

`This is an article about macOS environment, but the procedure is the same for Windows environment. Please read and try the environment-dependent part. ``

Purpose

After reading this article to the end, you will be able to:

No. Overview keyword
1 Build Docker image/push heroku container:push web
2 Release of Docker image heroku container:release web

Execution environment

environment Ver.
macOS Catalina 10.15.6
Python 3.7.3
Heroku 7.42.13
Docker 19.03.12
Flask 1.1.2
gunicorn 20.0.4
Jinja2 2.11.2
Werkzeug 1.0.1

Source code

I think that understanding will deepen if you read while actually following the implementation contents and source code. Please use it by all means.

Related articles

procedure

1. Container Registry login

command.sh


~% heroku container:login

2. Get sample code

command.sh


~% git clone https://github.com/nsuhara/heroku-docker.git -b master

tree.sh


heroku-docker
    ├── Dockerfile
    ├── docker-compose.yml
    ├── docker_compose_up.sh
    └── webapp
            ├── app.py
            ├── requirements.txt
            ├── tests
            │       ├── __init__.py
            │       └── tests.py
            └── wsgi.py

3. Move directory

command.sh


~% cd heroku-docker

4. Create Heroku app

* This app name will be automatically generated

command.sh


~% heroku create
Creating app... done, ⬢ {app-name}

5. Remote repository settings

command.sh


~% heroku git:remote -a {app-name}

6. Image Build & Container Registry Push

command.sh


~% heroku container:push web

7. Container Registry release

command.sh


~% heroku container:release web

8. App display

command.sh


~% heroku open

bonus

Local environment application display

command.sh


~% sh docker_compose_up.sh

command.sh


~% open http://0.0.0.0:5000/

Code check (pylint)

command.sh


~% python -B -m pylint --rcfile=.pylintrc -f parseable `find webapp -name "*.py" -not -path "webapp/tests"`

Code test (unittest)

command.sh


~% python -B -m unittest discover tests

Recommended Posts

Deploy Flask's Docker image on Heroku
heroku: docker: deploy
Deploy Rails on Docker to heroku
How to deploy on heroku
How to deploy to Heroku from a local docker image
Run puppeteer-core on Heroku (Docker edition)
heroku deploy
Deploy a war file on Heroku
Deploy your Rails app on Heroku
Publish Docker Image on GitHub Package Registry
Customize OpenFOAM v8 Docker Image on Mac
Deploy to heroku with Docker (Rails 6, MySQL)
Deploy to Heroku [Ruby on Rails] Beginner
Deploy a Java web app on Heroku
Deploy a Tomcat-based Eclipse project on Heroku
Liberty on Docker
Redmine on Docker
Update container image with KUSANAGI Runs on Docker
Deploy Line bot with rails5 + Docker + Heroku Note
Docker installation on CentOS 6
python notes on docker
Deploy laravel using docker on EC2 on AWS ① (Create EC2 instance)
Rails deploy with Docker
Deploy RAILS on EC2
Yay! I'm on Heroku!
Use Corretto 11 on Heroku
M.S. docker on Windows
Docker installation on WSL2
Error resolution on Heroku
Run phpunit on Docker
Deploy laravel using docker on EC2 on AWS ② (Elastic IP acquisition-linking)
Until you run Quarkus and run docker image on Amazon ECS
How to deploy a simple Java Servlet app on Heroku
Deploy laravel using docker on EC2 on AWS ④ (git clone ~ deploy, migration)
Install Docker on Raspberry Pi
Install Docker on Windows 10 PRO
Run VS Code on Docker
Deploy Vapor Project to Heroku
Install Docker on Ubuntu Server 20.04
Introduce Rails/Basic authentication on Heroku.
Install yarn in docker image
Run openvpn on Docker (windows)
Try Docker on Windows 10 Home
docker review image creation-container start
Oracle Java 8 on Docker Ubuntu
Extract files from Docker Image
Hosted Apicurio Studio on Docker
Install docker on AWS EC2
Use PG Backups on Heroku
Deploy laravel using docker on EC2 on AWS ③ (SSH connection ~ Docke-compose installation)
Create a Docker Image for redoc-cli and register it on Docker Hub
Run (provisionally) a Docker image with ShellCommandActivity on AWS Data Pipeline
I was able to deploy the Docker + laravel + MySQL app to Heroku!