Docker start stuff

This commit is contained in:
2025-04-21 14:01:53 +02:00
parent 2ce2ff7cb4
commit a1b6767722
2 changed files with 15 additions and 0 deletions

View File

@@ -21,5 +21,9 @@ RUN pip install -r requirements.txt
# Copy project files # Copy project files
COPY . . COPY . .
COPY docker-entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
# Specify default command # Specify default command
CMD ["python", "app.py"] CMD ["python", "app.py"]

11
entrypoint.sh Normal file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
# Wait for DB to be ready (optional step)
# ./wait-for-it.sh db:5432 --timeout=30 -- echo "DB is up"
# Only run flask db init if migrations folder doesn't exist
if [ ! -d "migrations" ]; then
flask db init
fi
flask db migrate -m "Autogenerated migration"
flask db upgrade