diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9cd6cfe --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.9.18-alpine +COPY /app /app +WORKDIR /app +RUN pip install -r requirements.txt +EXPOSE 5000 +ENTRYPOINT [ "python" ] +CMD [ "portable.py" ] \ No newline at end of file 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 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 98% rename from portable.py rename to app/portable.py index 9f84c4b..a71454b 100644 --- a/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=5000, debug=False) diff --git a/app/requirements.txt b/app/requirements.txt new file mode 100644 index 0000000..7e10602 --- /dev/null +++ b/app/requirements.txt @@ -0,0 +1 @@ +flask 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