add entrypoint to dockerfile
This commit is contained in:
@@ -54,4 +54,9 @@ RUN composer install --prefer-dist --no-scripts --no-dev --optimize-autoloader
|
||||
|
||||
EXPOSE 9000
|
||||
|
||||
COPY entrypoint.sh /usr/bin
|
||||
RUN chmod +x /usr/bin/entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/usr/bin/entrypoint.sh"]
|
||||
|
||||
CMD ["php-fpm"]
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
echo "Creating the database if it does not exist..."
|
||||
php bin/console doctrine:database:create --if-not-exists
|
||||
|
||||
# Check if migrations need to be applied
|
||||
if ! php bin/console doctrine:migrations:up-to-date --quiet; then
|
||||
echo "Applying migrations..."
|
||||
php bin/console doctrine:migrations:migrate --no-interaction
|
||||
fi
|
||||
|
||||
# Check if FORCE_SCHEMA_UPDATE is set to true
|
||||
if [ "$FORCE_SCHEMA_UPDATE" = "true" ]; then
|
||||
echo "Forcing schema update..."
|
||||
php bin/console doctrine:schema:update --force
|
||||
fi
|
||||
|
||||
# Execute the CMD from the Dockerfile
|
||||
exec "$@"
|
||||
Reference in New Issue
Block a user