diff --git a/.python-version b/.python-version new file mode 100644 index 000000000..9919bf8c9 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.10.13 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..4211167da --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM ubuntu:22.04 +RUN apt-get update \ + && apt-get install python3 python3-pip -y \ + && mkdir /app/ \ + && mkdir /req/ +ADD requirements.txt /req/ + +WORKDIR / +ADD app /app +RUN pip install -r /req/requirements.txt +ENV FLASK_ENV=DEVELOPMENT +ENV FLASK_RUN_HOST=0.0.0.0 +EXPOSE 5000 +CMD ["python3","/app/app.py"] diff --git a/Dockerfile_Lector_Solution b/Dockerfile_Lector_Solution new file mode 100644 index 000000000..90417ce69 --- /dev/null +++ b/Dockerfile_Lector_Solution @@ -0,0 +1,19 @@ +FROM ubuntu:22.04 + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + python3 \ + python3-pip \ + && mkdir -p /app \ + && useradd -d /app -s /bin/bash app \ + && chown -R app:app /app + +COPY requirements.txt /app/requirements.txt +RUN pip3 install -r /app/requirements.txt + +COPY app/app.py /app +WORKDIR /app + +USER app + +CMD ["python3", "app.py"] diff --git a/app/app.py b/app/app.py new file mode 100644 index 000000000..66ca02904 --- /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(debug=True,host="0.0.0.0",port=os.environ.get("PORT", 5000)) diff --git a/app/app_test.py b/app/app_test.py new file mode 100644 index 000000000..a1b1bacb2 --- /dev/null +++ b/app/app_test.py @@ -0,0 +1,17 @@ +import unittest + +from app import app + + +class TestApp(unittest.TestCase): + def setUp(self): + self.client = app.test_client() + + def test_hello_world(self): + response = self.client.get("/") + self.assertEqual(response.status_code, 200) + self.assertEqual(response.data, b"Hello, World!") + + +if __name__ == "__main__": + unittest.main() diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..75cb9a31a --- /dev/null +++ b/requirements.txt @@ -0,0 +1,8 @@ +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"