dmilon / flask-rest-api-docker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docker Flask REST API

REST API using Flask in Docker with a Restaurant model

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on Heroku.

Prerequisites

You need to have Docker Engine installed and running on your computer. If this is not the case, go here

Installing

In a terminal, clone this repository, cd into it and build the Docker image:

docker build -t flask-rest-api .

Then run a container from this image:

docker run -d -p 5000:5000 flask-rest-api

Your app is now up and running locally. You can visit localhost:5000/restaurants to get all your restaurants.

For more information about basic Docker Engine commands, go here

Deployment

These instructions will show you how to deploy the project on Heroku, knowing that you already have a built image on your local machine.

Prerequisites

You need to have Heroku CLI installed on your computer and you should be logged in your account. If this is not the case, go here

Deploying

Open a terminal in your project folder and create your app on Heroku:

heroku create my-app-name --region eu

Provision a Postgres database on Heroku: go to your app dashboard, resources, add-ons and add a Heroku Postgres add-on.

Back in your terminal, push your already built Docker image to Heroku:

heroku container:push web

Then release it:

heroku container:release web

Your app is now up and running in production. You can visit https://www.my-app-name.herokuapp.com/restaurants to get all your restaurants.

For more information about basic Heroku CLI commands, go here

Authors

About


Languages

Language:Python 89.0%Language:Dockerfile 11.0%