Add entrypoint to run migrations at start

This commit is contained in:
KenwoodFox 2025-12-03 18:54:30 -05:00
parent c97b06e07b
commit 53c6fad262
2 changed files with 16 additions and 0 deletions

View File

@ -14,4 +14,9 @@ COPY . /app
# Collect static files for WhiteNoise
RUN python manage.py collectstatic --noinput
# Make entrypoint script executable
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["gunicorn", "seduttomachineworks_project.wsgi:application", "--bind", "0.0.0.0:8000"]

11
docker-entrypoint.sh Normal file
View File

@ -0,0 +1,11 @@
#!/bin/bash
set -e
# Run migrations
echo "Running database migrations..."
python manage.py migrate --noinput
# Start the application
echo "Starting application..."
exec "$@"