toailao125 commited on
Commit
03a1acd
1 Parent(s): 4a46185
Files changed (3) hide show
  1. Dockerfile +14 -0
  2. app.py +16 -0
  3. requirements.txt +3 -0
Dockerfile ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ FROM python:3.9
3
+
4
+ RUN useradd -m -u 1000 user
5
+ USER user
6
+ ENV PATH="/home/user/.local/bin:$PATH"
7
+
8
+ WORKDIR /app
9
+
10
+ COPY --chown=user ./requirements.txt requirements.txt
11
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
12
+
13
+ COPY --chown=user . /app
14
+ CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:5000", "", "app:app"]
app.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, jsonify, request
2
+
3
+ app = Flask(__name__)
4
+
5
+ @app.route('/')
6
+ def home():
7
+ return jsonify({
8
+ 'author': 'Phạm Quốc Cường'
9
+ })
10
+
11
+ @app.errorhandler(404)
12
+ def not_found(error):
13
+ return jsonify({
14
+ "author":"Phạm Quốc Cường",
15
+ "link":"https://www.facebook.com/pqc2304"
16
+ }), 404
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ Flask
2
+ requests
3
+ gunicorn