Fix Dockerfile static copy, dynamic port, health endpoint
Some checks failed
Build and Deploy citti / build-and-deploy (push) Has been cancelled

- Remove COPY static/ (runtime uploads live in DATA_DIR/uploads)
- Add /health endpoint
- Read PORT from env (NOMAD_PORT_http in production, 9756 local)
- citti.nomad: dynamic port, canary deploy, Consul/Traefik, health check

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Henrik Jess Nielsen
2026-06-06 01:04:29 +02:00
parent 77eed9aa50
commit d7ab8e02a1
3 changed files with 100 additions and 28 deletions

12
app.py
View File

@@ -191,6 +191,11 @@ def serve_upload(filename):
return send_from_directory(UPLOAD_DIR, filename)
@app.route('/health')
def health():
return jsonify({'status': 'healthy', 'service': 'citti'})
@app.route('/api/category', methods=['POST'])
def add_category():
d = request.json
@@ -255,6 +260,7 @@ def analyse():
if __name__ == '__main__':
init_db()
port = int(os.environ.get('PORT', 9756))
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
@@ -262,6 +268,6 @@ if __name__ == '__main__':
s.close()
except Exception:
local_ip = "127.0.0.1"
print(f"\n Computer: http://localhost:9756")
print(f" Telefon (samme WiFi): http://{local_ip}:9756\n")
app.run(host='0.0.0.0', port=9756, debug=False)
print(f"\n Computer: http://localhost:{port}")
print(f" Telefon (samme WiFi): http://{local_ip}:{port}\n")
app.run(host='0.0.0.0', port=port, debug=False)