modified: Dockerfile

modified:   README.md
	modified:   app.py
This commit is contained in:
SimolZimol
2025-10-26 19:20:32 +01:00
parent 09b0b2f3b7
commit 347902d518
3 changed files with 33 additions and 4 deletions

View File

@@ -26,5 +26,5 @@ ENV DEMO=$DEMO
EXPOSE 5000 EXPOSE 5000
# Production server # Production server (use shell form so $PORT expands in Coolify)
CMD ["gunicorn", "-w", "3", "-b", "0.0.0.0:5000", "app:app"] CMD gunicorn -w ${WEB_CONCURRENCY:-3} -b 0.0.0.0:${PORT:-5000} app:app

View File

@@ -58,6 +58,26 @@ docker run --rm -p 5000:5000 devanturas-site
# Open http://localhost:5000 # Open http://localhost:5000
``` ```
## Deploy on Coolify
You can deploy this app on Coolify using the existing Dockerfile:
1) Create a new Application in Coolify and choose "Dockerfile" as the build type.
2) Point it to your repository and path where this project lives.
3) Environment variables (set in Coolify UI):
- PORT: Coolify usually sets this automatically; the container binds to `0.0.0.0:$PORT`.
- FLASK_DEBUG=false (optional)
- WEB_CONCURRENCY=3 (optional Gunicorn workers override)
- DEMO=... (example passthrough, Dockerfile includes `ENV DEMO=$DEMO`)
4) Exposed port: 5000 (Dockerfile uses `EXPOSE 5000` and `CMD` binds to `$PORT` with a default of 5000.)
5) Health check: GET /health should return 200 with `{ "status": "ok" }`.
No other platform-specific files are required. Coolify will build the image from the Dockerfile and run it with the configured environment.
## Customization ## Customization
- Add more projects by updating the data structures in `app.py` under `/projects` and the detail routes. - Add more projects by updating the data structures in `app.py` under `/projects` and the detail routes.
- To add Wiki/Issues links per project, populate the `links` dict with `wiki` and `issues` keys. If a project should not expose these, simply omit the keys and the template wont render them. - To add Wiki/Issues links per project, populate the `links` dict with `wiki` and `issues` keys. If a project should not expose these, simply omit the keys and the template wont render them.

13
app.py
View File

@@ -1,4 +1,5 @@
from flask import Flask, render_template import os
from flask import Flask, render_template, jsonify
app = Flask(__name__) app = Flask(__name__)
@@ -229,6 +230,11 @@ def contact():
] ]
return render_template('contact.html', links=contact_links) return render_template('contact.html', links=contact_links)
# Healthcheck endpoint for platforms like Coolify
@app.route('/health')
def health():
return jsonify(status='ok'), 200
# Project detail pages # Project detail pages
@app.route('/projects/fly-plugin') @app.route('/projects/fly-plugin')
def fly_plugin(): def fly_plugin():
@@ -436,4 +442,7 @@ def discord_bot_stable_diffusion_amd():
return render_template('project_detail.html', project=project) return render_template('project_detail.html', project=project)
if __name__ == '__main__': if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0', port=5000) # Allow overriding via environment (e.g., Coolify sets PORT)
port = int(os.getenv('PORT', '5000'))
debug = os.getenv('FLASK_DEBUG', 'false').lower() == 'true'
app.run(debug=debug, host='0.0.0.0', port=port)