From 478efbf67306a092425252604826835b66d4217d Mon Sep 17 00:00:00 2001 From: Sakari Hoisko Date: Wed, 7 Oct 2020 12:58:07 +0300 Subject: [PATCH 1/2] server.py listening address 0.0.0.0 that is more wider than just localhost. Added dockerized solution to demoapp. --- README.rst | 5 +++++ demoapp/server.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index f694c6d..5dddc31 100644 --- a/README.rst +++ b/README.rst @@ -125,6 +125,11 @@ If the application was started by double-clicking ``demoapp/server.py`` file, it can be shut down by closing the opened window. If it was executed from the command line, using ``Ctrl-C`` is enough. +OR with docker-compose: +Start to backround: `docker-compose up -d` +Stop: `docker-compose down` + + Running tests ------------- diff --git a/demoapp/server.py b/demoapp/server.py index a961366..b619c9e 100755 --- a/demoapp/server.py +++ b/demoapp/server.py @@ -34,7 +34,7 @@ class DemoServer(ThreadingMixIn, HTTPServer): allow_reuse_address = True def __init__(self, port=PORT): - HTTPServer.__init__(self, ('localhost', int(port)), + HTTPServer.__init__(self, ('0.0.0.0', int(port)), SimpleHTTPRequestHandler) def serve(self, directory=ROOT): From 6e5b180050528b71ac581c25cde0e87952cbd3de Mon Sep 17 00:00:00 2001 From: Sakari Hoisko Date: Wed, 7 Oct 2020 13:13:51 +0300 Subject: [PATCH 2/2] Added demoapp/Dockerfile and docker-compose.yaml file --- demoapp/Dockerfile | 5 +++++ docker-compose.yaml | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 demoapp/Dockerfile create mode 100644 docker-compose.yaml diff --git a/demoapp/Dockerfile b/demoapp/Dockerfile new file mode 100644 index 0000000..088cf2b --- /dev/null +++ b/demoapp/Dockerfile @@ -0,0 +1,5 @@ +FROM python:alpine +COPY ./ /demoapp/ +EXPOSE 7272 +RUN chmod +x /demoapp/server.py +ENTRYPOINT [ "/demoapp/server.py" ] diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..4a4ad12 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,8 @@ +version: '2' +services: + webdemo: + build: + context: ./demoapp + dockerfile: Dockerfile + ports: + - '7272:7272' \ No newline at end of file