From 4cb26457d1254c74f40c2358ce53baf360cc45bf Mon Sep 17 00:00:00 2001 From: Iliyan Vutov Date: Wed, 16 Oct 2024 18:29:02 +0300 Subject: [PATCH 1/7] U24 --- .python-version | 1 + app/app.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 .python-version create mode 100644 app/app.py diff --git a/.python-version b/.python-version new file mode 100644 index 000000000..b6d8b7612 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.11.8 diff --git a/app/app.py b/app/app.py new file mode 100644 index 000000000..67e0180c0 --- /dev/null +++ b/app/app.py @@ -0,0 +1,14 @@ +import os + +from flask import Flask + +app = Flask(__name__) + + +@app.route("/") +def hello_world(): + return "Hello, World!" + + +if __name__ == "__main__": + app.run(port=os.environ.get("PORT", 3000), host="0.0.0.0") From ae1daf88d06f2d900bc1b650f9966192246e661b Mon Sep 17 00:00:00 2001 From: Iliyan Vutov Date: Wed, 23 Oct 2024 19:23:42 +0300 Subject: [PATCH 2/7] Add 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 000000000..047e9501a --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +Flask==3.0.0 From 63b2492b829944f58a8ffd2e2a5d7d8295b72f8e Mon Sep 17 00:00:00 2001 From: Iliyan Vutov Date: Wed, 23 Oct 2024 19:24:30 +0300 Subject: [PATCH 3/7] Add requirements.txt --- requirements.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 047e9501a..b5ba78cca 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,9 @@ -Flask==3.0.0 +blinker==1.6.3 ; python_version >= "3.10" and python_version < "4.0" +click==8.1.7 ; python_version >= "3.10" and python_version < "4.0" +colorama==0.4.6 ; python_version >= "3.10" and python_version < "4.0" and platform_system == "Windows" +flask==3.0.0 ; python_version >= "3.10" and python_version < "4.0" +itsdangerous==2.1.2 ; python_version >= "3.10" and python_version < "4.0" +jinja2==3.1.2 ; python_version >= "3.10" and python_version < "4.0" +markupsafe==2.1.3 ; python_version >= "3.10" and python_version < "4.0" +werkzeug==3.0.0 ; python_version >= "3.10" and python_version < "4.0" + From 0c3ce3f930bdcdd9b1a8ae0e035afdc3a0666024 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 23 Oct 2024 19:51:39 +0300 Subject: [PATCH 4/7] re-adding text file to my forked branch from OG repo --- dockerfile | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 dockerfile diff --git a/dockerfile b/dockerfile new file mode 100644 index 000000000..fac87a9de --- /dev/null +++ b/dockerfile @@ -0,0 +1,5 @@ +FROM ubuntu:24.04 +WORKDIR /ap +COPY requirements.txt ./ + + From bbdc9ee11ddb4190852a066f3fead2a51e001937 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 23 Oct 2024 20:23:13 +0300 Subject: [PATCH 5/7] Dockerfile edited. --- dockerfile | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/dockerfile b/dockerfile index fac87a9de..e590a48ec 100644 --- a/dockerfile +++ b/dockerfile @@ -1,5 +1,18 @@ FROM ubuntu:24.04 -WORKDIR /ap +WORKDIR /app COPY requirements.txt ./ +RUN apt-get update && \ +apt-get upgrade -y && \ +apt-get install -y \ +python3\ +python-pip +COPY app/ /app + + + +COPY requirements.txt +RUN pip install --break-system-packages -r requirements.txt + +CMD ["python3" , "-m" ,"flask" , "run" , "--host=0.0.0.0" ] From d7c12fb79ef6982c455aa5ba694aa30aafb0d44b Mon Sep 17 00:00:00 2001 From: root Date: Wed, 23 Oct 2024 20:49:56 +0300 Subject: [PATCH 6/7] final updates; docker image configured and tested --- dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dockerfile b/dockerfile index e590a48ec..d5f4d93b8 100644 --- a/dockerfile +++ b/dockerfile @@ -5,14 +5,14 @@ COPY requirements.txt ./ RUN apt-get update && \ apt-get upgrade -y && \ apt-get install -y \ -python3\ -python-pip +python3 \ +python3-pip COPY app/ /app -COPY requirements.txt +COPY requirements.txt ./ RUN pip install --break-system-packages -r requirements.txt - +# EXPOSE 5000 CMD ["python3" , "-m" ,"flask" , "run" , "--host=0.0.0.0" ] From 5762d2bcfd707f2ed087d25b777def2f77272898 Mon Sep 17 00:00:00 2001 From: Atanas Petrov Date: Wed, 23 Oct 2024 21:16:32 +0300 Subject: [PATCH 7/7] User added to dockerfile --- dockerfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dockerfile b/dockerfile index d5f4d93b8..96f47f05c 100644 --- a/dockerfile +++ b/dockerfile @@ -1,18 +1,20 @@ FROM ubuntu:24.04 WORKDIR /app -COPY requirements.txt ./ +COPY --chown=user1 requirements.txt ./ -RUN apt-get update && \ +# no need to have " / " + +RUN useradd user1 +apt-get update && \ apt-get upgrade -y && \ apt-get install -y \ python3 \ python3-pip -COPY app/ /app +RUN pip install --break-system-packages -r requirements.txt +COPY --chown=user1 app/ /app -COPY requirements.txt ./ -RUN pip install --break-system-packages -r requirements.txt # EXPOSE 5000 CMD ["python3" , "-m" ,"flask" , "run" , "--host=0.0.0.0" ]