From 11d13ae0ef60299e8ae6673ebdf27988e0f972ab Mon Sep 17 00:00:00 2001 From: Justin Paul Date: Tue, 31 Oct 2023 09:11:54 -0400 Subject: [PATCH 1/9] dockerized --- Dockerfile | 7 +++++++ index.html => app/index.html | 0 index.py => app/index.py | 0 portable.py => app/portable.py | 0 requirements.txt => app/requirements.txt | 0 {screenshots => app/screenshots}/step-1.png | Bin {screenshots => app/screenshots}/step-2.png | Bin {screenshots => app/screenshots}/step-3.png | Bin {screenshots => app/screenshots}/step-4.gif | Bin docker-compose.yaml | 7 +++++++ 10 files changed, 14 insertions(+) create mode 100644 Dockerfile rename index.html => app/index.html (100%) rename index.py => app/index.py (100%) rename portable.py => app/portable.py (100%) rename requirements.txt => app/requirements.txt (100%) rename {screenshots => app/screenshots}/step-1.png (100%) rename {screenshots => app/screenshots}/step-2.png (100%) rename {screenshots => app/screenshots}/step-3.png (100%) rename {screenshots => app/screenshots}/step-4.gif (100%) create mode 100644 docker-compose.yaml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e2a5f2f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM python:alpine3.7 +COPY /app /app +WORKDIR /app +RUN pip install -r requirements.txt +EXPOSE 5001 +ENTRYPOINT [ "python" ] +CMD [ "portable.py" ] \ No newline at end of file diff --git a/index.html b/app/index.html similarity index 100% rename from index.html rename to app/index.html diff --git a/index.py b/app/index.py similarity index 100% rename from index.py rename to app/index.py diff --git a/portable.py b/app/portable.py similarity index 100% rename from portable.py rename to app/portable.py diff --git a/requirements.txt b/app/requirements.txt similarity index 100% rename from requirements.txt rename to app/requirements.txt diff --git a/screenshots/step-1.png b/app/screenshots/step-1.png similarity index 100% rename from screenshots/step-1.png rename to app/screenshots/step-1.png diff --git a/screenshots/step-2.png b/app/screenshots/step-2.png similarity index 100% rename from screenshots/step-2.png rename to app/screenshots/step-2.png diff --git a/screenshots/step-3.png b/app/screenshots/step-3.png similarity index 100% rename from screenshots/step-3.png rename to app/screenshots/step-3.png diff --git a/screenshots/step-4.gif b/app/screenshots/step-4.gif similarity index 100% rename from screenshots/step-4.gif rename to app/screenshots/step-4.gif diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..799a2a8 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,7 @@ +version: '3' +services: + 13ft: + build: . + #image: your-image-name:tag + ports: + - "5000:5000" \ No newline at end of file From 0ad0e3e341e4924fbdaf8655c4c5c185fc79d8e2 Mon Sep 17 00:00:00 2001 From: Justin Paul Date: Tue, 31 Oct 2023 09:16:14 -0400 Subject: [PATCH 2/9] Update requirements.txt forgot to readd requests to requirements file --- app/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/app/requirements.txt b/app/requirements.txt index 7e10602..5eaf725 100644 --- a/app/requirements.txt +++ b/app/requirements.txt @@ -1 +1,2 @@ flask +requests \ No newline at end of file From 32cde2f385485bf91ede3169533151ef2f2e7e1e Mon Sep 17 00:00:00 2001 From: Justin Paul Date: Tue, 31 Oct 2023 09:25:14 -0400 Subject: [PATCH 3/9] Update portable.py listen on all interfaces --- app/portable.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/portable.py b/app/portable.py index 9f84c4b..ec7c0e8 100644 --- a/app/portable.py +++ b/app/portable.py @@ -130,4 +130,4 @@ def get_article(path): return "Invalid URL", 400 -app.run(debug=False) +app.run(host='0.0.0.0', port=5001, debug=False) From 0652e13434f6695deafa917d705a85eb18adddc2 Mon Sep 17 00:00:00 2001 From: Justin Paul Date: Tue, 31 Oct 2023 09:26:21 -0400 Subject: [PATCH 4/9] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e2a5f2f..20d3c1f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:alpine3.7 +FROM python:3.9.18-alpine COPY /app /app WORKDIR /app RUN pip install -r requirements.txt From 69544ada63dd99d78970d7ebb115f4b77def313e Mon Sep 17 00:00:00 2001 From: Justin Paul Date: Tue, 31 Oct 2023 09:28:13 -0400 Subject: [PATCH 5/9] Update portable.py --- app/portable.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/portable.py b/app/portable.py index ec7c0e8..a71454b 100644 --- a/app/portable.py +++ b/app/portable.py @@ -130,4 +130,4 @@ def get_article(path): return "Invalid URL", 400 -app.run(host='0.0.0.0', port=5001, debug=False) +app.run(host='0.0.0.0', port=5000, debug=False) From 006374c732cab1d255b6f227dab55536a3fd5550 Mon Sep 17 00:00:00 2001 From: Justin Paul Date: Tue, 31 Oct 2023 09:30:13 -0400 Subject: [PATCH 6/9] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 20d3c1f..9cd6cfe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,6 @@ FROM python:3.9.18-alpine COPY /app /app WORKDIR /app RUN pip install -r requirements.txt -EXPOSE 5001 +EXPOSE 5000 ENTRYPOINT [ "python" ] CMD [ "portable.py" ] \ No newline at end of file From bf66afa6e0928362c0f95e4dd283b3c471b8a07d Mon Sep 17 00:00:00 2001 From: Justin Paul Date: Tue, 31 Oct 2023 09:40:10 -0400 Subject: [PATCH 7/9] Update README.md --- README.md | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ca2850b..34b4802 100644 --- a/README.md +++ b/README.md @@ -12,15 +12,38 @@ It pretends to be GoogleBot (Google's web crawler) and gets the same content tha ## How do I use it? -First make sure you have [python](https://python.org) installed on your machine, then go to a terminal (`Command Prompt` on Windows, `Terminal` on Mac) and run the following command: +### Using Docker + +Requirements: +- docker +- docker-compose + +First, clone the repo to your machine, then run the following commands: ```sh -python -m pip install flask +git clone https://github.com/wasi-master/13ft.git +cd 13ft +docker-compose up +``` + +### Standard Python script + +First, make sure you have [python](https://python.org) installed on your machine. Next, clone the git repo. Then go to a terminal (`Command Prompt` on Windows, `Terminal` on Mac) and run the following command: + +From the git cloned directory on your computer: + +```sh +cd app/ +python -m pip install -r requirements.txt ``` If that doesn't work retry but replace `python` with `py`, then try `python3`, then try `py3` -Then download the file `portable.py` and run it, click [this link](https://realpython.com/run-python-scripts/) for a tutorial on how to run python scripts +Then run `portable.py`, click [this link](https://realpython.com/run-python-scripts/) for a tutorial on how to run python scripts. + +```sh +python portable.py +``` Then follow these simple steps From f02ca7e96147618ba2b1d81ea25ed1c3f7969543 Mon Sep 17 00:00:00 2001 From: Wasi Master <63045920+wasi-master@users.noreply.github.com> Date: Tue, 31 Oct 2023 21:57:06 +0600 Subject: [PATCH 8/9] Revert requirements.txt --- app/requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/app/requirements.txt b/app/requirements.txt index 5eaf725..7e10602 100644 --- a/app/requirements.txt +++ b/app/requirements.txt @@ -1,2 +1 @@ flask -requests \ No newline at end of file From 4431d63afcec200136b9d83af036839081d22454 Mon Sep 17 00:00:00 2001 From: Wasi Master <63045920+wasi-master@users.noreply.github.com> Date: Tue, 31 Oct 2023 22:00:12 +0600 Subject: [PATCH 9/9] Create requirements.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..7e10602 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +flask