mirror of
https://github.com/kevinveenbirkenbach/homepage.veen.world.git
synced 2025-07-07 03:25:12 +02:00
Solved other port bugs
This commit is contained in:
parent
35bfeeb51e
commit
5fc19f6ccb
@ -11,11 +11,5 @@ RUN pip install --no-cache-dir -r requirements.txt
|
||||
# Copy application code
|
||||
COPY app/ .
|
||||
|
||||
# Set default port environment variable
|
||||
ENV PORT=5000
|
||||
|
||||
# Expose port (optional for documentation)
|
||||
EXPOSE ${PORT}
|
||||
|
||||
# Start command using shell to allow env substitution
|
||||
CMD ["sh", "-c", "exec python app.py --port=${PORT}"]
|
||||
CMD sh -c "exec python app.py --port=\${PORT}"
|
||||
|
12
app/app.py
12
app/app.py
@ -4,6 +4,12 @@ import yaml
|
||||
from utils.configuration_resolver import ConfigurationResolver
|
||||
from utils.cache_manager import CacheManager
|
||||
from utils.compute_card_classes import compute_card_classes
|
||||
import logging
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
FLASK_ENV = os.getenv("FLASK_ENV", "production")
|
||||
FLASK_PORT = int(os.getenv("PORT", 5000))
|
||||
print(f"🔧 Starting app on port {FLASK_PORT}, FLASK_ENV={FLASK_ENV}")
|
||||
|
||||
|
||||
# Initialize the CacheManager
|
||||
cache_manager = CacheManager()
|
||||
@ -31,9 +37,6 @@ def cache_icons_and_logos(app):
|
||||
app.config["platform"]["favicon"]["cache"] = cache_manager.cache_file(app.config["platform"]["favicon"]["source"])
|
||||
app.config["platform"]["logo"]["cache"] = cache_manager.cache_file(app.config["platform"]["logo"]["source"])
|
||||
|
||||
# Get the environment variable FLASK_ENV or set a default value
|
||||
FLASK_ENV = os.getenv("FLASK_ENV", "production")
|
||||
|
||||
# Initialize Flask app
|
||||
app = Flask(__name__)
|
||||
|
||||
@ -64,5 +67,4 @@ def index():
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
port = int(os.getenv("PORT", 5000))
|
||||
app.run(debug=(FLASK_ENV == "development"), host="0.0.0.0", port=port)
|
||||
app.run(debug=(FLASK_ENV == "development"), host="0.0.0.0", port=FLASK_PORT)
|
||||
|
@ -11,6 +11,7 @@ services:
|
||||
- "${PORT:-5000}:${PORT:-5000}"
|
||||
volumes:
|
||||
- ./app:/app
|
||||
- ./.env:/app./.env
|
||||
environment:
|
||||
- PORT=${PORT:-5000}
|
||||
restart: unless-stopped
|
||||
|
Loading…
x
Reference in New Issue
Block a user