This commit is contained in:
2025-05-22 20:39:04 +02:00
parent 5d0209f7a4
commit d450994857
2 changed files with 18 additions and 2 deletions

View File

@@ -24,5 +24,9 @@ EXPOSE 5000
ENV FLASK_APP=app.py
ENV FLASK_ENV=production
# Run the application with gunicorn
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--chdir", "/app", "app:app"]
# Create a startup script
RUN echo '#!/bin/bash\npython init_db.py\ngunicorn --bind 0.0.0.0:5000 --chdir /app app:app' > /app/start.sh
RUN chmod +x /app/start.sh
# Run the startup script
CMD ["/app/start.sh"]

12
init_db.py Normal file
View File

@@ -0,0 +1,12 @@
from app import app, db
from flask_migrate import upgrade
def init_db():
with app.app_context():
# Create all tables
db.create_all()
# Run any pending migrations
upgrade()
if __name__ == '__main__':
init_db()