Petermoyano commited on
Commit
ab02082
·
1 Parent(s): b46c888

Add Dockefile

Browse files
Files changed (3) hide show
  1. Dockerfile +20 -0
  2. app.py +3 -1
  3. requirements.txt +9 -0
Dockerfile ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use an official Python runtime as a parent image
2
+ FROM python:3.8-slim
3
+
4
+ # Set the working directory in the container
5
+ WORKDIR /app
6
+
7
+ # Copy the current directory contents into the container at /app
8
+ COPY . /app
9
+
10
+ # Install any needed packages specified in requirements.txt
11
+ RUN pip install --no-cache-dir -r requirements.txt
12
+
13
+ # Make port 5000 available to the world outside this container
14
+ EXPOSE 5000
15
+
16
+ # Define environment variable
17
+ ENV NAME becognitium
18
+
19
+ # Run app.py when the container launches
20
+ CMD ["gunicorn", "-w 4", "-b 0.0.0.0:5000", "app:app"]
app.py CHANGED
@@ -7,4 +7,6 @@ def hello_world():
7
  return 'Hello, World!'
8
 
9
  if __name__ == '__main__':
10
- app.run(debug=True)
 
 
 
7
  return 'Hello, World!'
8
 
9
  if __name__ == '__main__':
10
+ from os import environ
11
+ app.run(host='0.0.0.0', port=int(environ.get('PORT', 5000)))
12
+
requirements.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ blinker==1.8.2
2
+ click==8.1.7
3
+ Flask==3.0.3
4
+ gunicorn==23.0.0
5
+ itsdangerous==2.2.0
6
+ Jinja2==3.1.4
7
+ MarkupSafe==2.1.5
8
+ packaging==24.1
9
+ Werkzeug==3.0.4