diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..8865779 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,14 @@ +version: "3.7" +services: + web1: + build: ./quote_gen + container_name: quote-gen-container + ports: + - "5002:5002" + web2: + build: ./quote_disp + container_name: quote-disp-container + ports: + - "5001:5001" + depends_on: + - web1 \ No newline at end of file diff --git a/quote_disp/Dockerfile b/quote_disp/Dockerfile new file mode 100644 index 0000000..0a9eb01 --- /dev/null +++ b/quote_disp/Dockerfile @@ -0,0 +1,6 @@ +FROM python:3.8-slim-buster +COPY . /app +WORKDIR /app +RUN pip install -r requirements.txt +ENTRYPOINT [ "python" ] +CMD [ "app.py" ] \ No newline at end of file diff --git a/quote_disp/app.py b/quote_disp/app.py index 18b3844..d5dd183 100644 --- a/quote_disp/app.py +++ b/quote_disp/app.py @@ -18,7 +18,7 @@ def home(): @app.route("/get_quote") def quote(): - quote = requests.get("http://gen:5000/quote").text + quote = requests.get("http://quote-gen-container:5002/quote").text print("quote - ", quote) return render_template("quote.html", quote=quote) diff --git a/quote_gen/Dockerfile b/quote_gen/Dockerfile new file mode 100644 index 0000000..0a9eb01 --- /dev/null +++ b/quote_gen/Dockerfile @@ -0,0 +1,6 @@ +FROM python:3.8-slim-buster +COPY . /app +WORKDIR /app +RUN pip install -r requirements.txt +ENTRYPOINT [ "python" ] +CMD [ "app.py" ] \ No newline at end of file diff --git a/quote_gen/app.py b/quote_gen/app.py index 7499579..af69925 100644 --- a/quote_gen/app.py +++ b/quote_gen/app.py @@ -40,4 +40,4 @@ def quote(): if __name__ == "__main__": - app.run(host="0.0.0.0", port=5000, debug=True) + app.run(host="0.0.0.0", port=5002, debug=True)