Sign inSign up

codeclou/docker-python-web

By codeclou

•Updated over 9 years ago

Docker Container that starts a python webapp mounted as volume.

Image
0

383

codeclou/docker-python-web repository overview

⁠docker-python-web

Docker-Image to run python webapps mounted as volume.


 

⁠Prerequisites

 


⁠Usage

Run the example-app like so.

docker run \
    -i -t \
    -v $(pwd)/example-app/:/pyapp/web \
    -v $(pwd)/data/:/pyapp/data \
    -p 8877:8000 \
    codeclou/docker-python-web:latest

Now go to http://localhost:8877⁠ and see your app. Note: Depending on how many dependencies you install, it might take some time until the server starts up. You can write to /pyapp/data/* from your application.


Run a commandline app like so

docker run \
    -i -t \
    -v $(pwd)/example-cli/:/pyapp/web \
    -v $(pwd)/data/:/pyapp/data \
    codeclou/docker-python-web:latest \
    python cli.py

 


⁠Application Requirements

See the example-app⁠ and abide the following conventions for your application:

  • Have a requirements.txt in the root of your project defining your dependencies
  • Have a app.py in the root of your project that starts a server on 8000 and listens on 0.0.0.0
  • Include the following line in your app to fetch the libs from extlibs dir
    • sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/extlibs/")

 

⁠License, Liability & Support

Tag summary

Content type

Image

Digest

Size

19 MB

Last updated

over 9 years ago

docker pull codeclou/docker-python-web