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/Dockerfile b/Dockerfile new file mode 100644 index 000000000..abc95f985 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +#Ubuntu 22.04 base image +FROM ubuntu:22.04 + +#Copy the requirements file +COPY requirements.txt . + +#Install python3 +RUN apt-get update && apt-get install -y python3 python3-pip \ + && useradd -m -s /bin/bash nruser \ + && pip install -r requirements.txt \ + && mkdir /app + +#Copy app +COPY --chown=nruser app /app + +#Switch to the non-root user +USER nruser + +#Add work dir +WORKDIR /app + +#Expose the port +EXPOSE 5000 + +#Add entrypoint +ENTRYPOINT [ "python3"] + +#Run the app +CMD ["app.py"] \ No newline at end of file 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") diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..0f800fccf --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +flask==3.0.0 \ No newline at end of file