mirror of
https://github.com/docker/awesome-compose.git
synced 2025-04-26 10:43:35 +02:00
Update flask version. Use docker discover host instead of using a environment variable way. Remove unnecessary files. In the endpoint /info, add the container id.
Signed-off-by: Dany Savard <dany.savard@gmail.com>
This commit is contained in:
parent
e6b1d2755f
commit
9faad90a8b
10 changed files with 46 additions and 31 deletions
|
@ -26,7 +26,4 @@ ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
|||
RUN export FLASK_APP=app.py
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
# define the port number the container should expose
|
||||
EXPOSE 5000
|
||||
|
||||
CMD ["python", "app.py"]
|
|
@ -1,4 +1,5 @@
|
|||
from flask import Flask, request, jsonify
|
||||
import socket
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
@ -17,6 +18,7 @@ def info():
|
|||
'connecting_ip': request.headers['X-Real-IP'],
|
||||
'proxy_ip': request.headers['X-Forwarded-For'],
|
||||
'host': request.headers['Host'],
|
||||
'containe_id': socket.gethostname(),
|
||||
'user-agent': request.headers['User-Agent']
|
||||
}
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
Flask==1.1.1
|
||||
gunicorn==20.0.4
|
||||
Flask==2.3.2
|
||||
gunicorn==21.0.1
|
|
@ -1,5 +0,0 @@
|
|||
from app import app
|
||||
import os
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(host='0.0.0.0', port=os.environ.get("FLASK_SERVER_PORT"), debug=True)
|
Loading…
Add table
Add a link
Reference in a new issue