From ce24d792cf3d7742fd6e5295a24a3d5dfcfc1018 Mon Sep 17 00:00:00 2001 From: Luke Else Date: Mon, 1 Jan 2024 15:39:48 +0000 Subject: [PATCH] Created dockerfile for running WMGZON web application --- app.py | 5 +++-- docker-compose.yml | 10 +++++++++- dockerfile | 7 +++++++ scripts/create_database.sh | 0 scripts/run_tests.sh | 0 5 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 dockerfile create mode 100644 scripts/create_database.sh create mode 100644 scripts/run_tests.sh diff --git a/app.py b/app.py index 820cbf3..83d4724 100644 --- a/app.py +++ b/app.py @@ -1,6 +1,7 @@ -from flask import Flask, render_template +from flask import Flask from os import environ from web import blueprint + ''' Main entrypoint for Flask application. Initialises any components that are needed at runtime such as the @@ -20,7 +21,7 @@ def main(): # Register a blueprint app.register_blueprint(blueprint) - app.run(debug=True) + app.run(debug=True, host="0.0.0.0") if __name__ == "__main__": main() diff --git a/docker-compose.yml b/docker-compose.yml index 9bb453f..46f96c2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,4 +10,12 @@ services: - ./data:/root/db ports: - '9000:9000' - restart: unless-stopped \ No newline at end of file + restart: unless-stopped + + wmgzon: + container_name: "wmgzon" + build: . + ports: + - "5000:5000" + volumes: + - .:/code \ No newline at end of file diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..530c789 --- /dev/null +++ b/dockerfile @@ -0,0 +1,7 @@ +FROM python:latest +COPY ./requirements.txt /app/requirements.txt +WORKDIR /app +RUN pip install -r requirements.txt +COPY . /app +ENTRYPOINT [ "python" ] +CMD ["app.py" ] \ No newline at end of file diff --git a/scripts/create_database.sh b/scripts/create_database.sh new file mode 100644 index 0000000..e69de29 diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh new file mode 100644 index 0000000..e69de29