Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11.8
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
14 changes: 14 additions & 0 deletions app/app.py
Original file line number Diff line number Diff line change
@@ -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")
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
flask==3.0.0