Coder Social home page Coder Social logo

flask-api-with-docker's Introduction

Building Flask API with Docker ⚗️

Python backend using Python3 Flask With Docker


SETUP ⚙️

pip3 install Flask

BUILD 🏗️

Debug Run

export FLASK_APP=flaskr
export FLASK_ENV=development

flask --app flaskr --debug run

Non debug run

  flask --app flaskr --no-debugger

App will start on http://127.0.0.1:5000

DEPLOYMENT 📦

Build Docker Container Image

docker build --tag python-docker .

Validate Image is created

docker images

Result:

(venv) D:\GitHub\Flask-API>docker images
REPOSITORY      TAG       IMAGE ID       CREATED          SIZE
python-docker   latest    199cf8a5350c   4 minutes ago    145MB

Run Container with flask

docker run -d -p 5000:5000 python-docker

Result:

(venv) D:\GitHub\Flask-API>docker ps
CONTAINER ID   IMAGE           COMMAND                  CREATED         STATUS         PORTS                    NAMES
df3f37944e57   python-docker   "flask --app flaskr …"   3 minutes ago   Up 3 minutes   0.0.0.0:5000->5000/tcp   jovial_joliot

Reference:

flask-api-with-docker's People

Contributors

hiteshsahu avatar

Stargazers

Roman avatar Abdessamad AALOUWAN                                                          avatar

Watchers

 avatar

Forkers

hitsio

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.