lol
This commit is contained in:
@@ -24,5 +24,9 @@ EXPOSE 5000
|
|||||||
ENV FLASK_APP=app.py
|
ENV FLASK_APP=app.py
|
||||||
ENV FLASK_ENV=production
|
ENV FLASK_ENV=production
|
||||||
|
|
||||||
# Run the application with gunicorn
|
# Create a startup script
|
||||||
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--chdir", "/app", "app:app"]
|
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
12
init_db.py
Normal 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()
|
||||||
Reference in New Issue
Block a user