2024-02-05 23:20:42 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2024-02-06 01:29:58 +00:00
|
|
|
# If there is no symfony.lock file, this isn't a symfony project
|
2024-02-05 23:20:42 +00:00
|
|
|
if [ ! -f /application/symfony.lock ]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-02-06 01:29:58 +00:00
|
|
|
# Determine if this is a specific variant of Symfny
|
2024-02-06 00:31:34 +00:00
|
|
|
if [ -d /application/config/bolt ]; then
|
2024-02-06 01:29:58 +00:00
|
|
|
echo " => Detected Symfony (Bolt) project"
|
2024-02-06 00:31:34 +00:00
|
|
|
VARIANT=bolt
|
|
|
|
else
|
2024-02-06 01:29:58 +00:00
|
|
|
echo " => Detected Symfony project"
|
2024-02-06 00:31:34 +00:00
|
|
|
VARIANT=vanilla
|
|
|
|
fi
|
|
|
|
|
2024-02-06 01:29:58 +00:00
|
|
|
# Call pre-init script
|
2024-02-06 00:31:34 +00:00
|
|
|
if [ -f /application/.symfony-preinit ]; then
|
|
|
|
echo " -> Running container-provided .symfony-preinit script"
|
|
|
|
sh /application/.symfony-preinit
|
|
|
|
fi
|
2024-02-06 00:00:58 +00:00
|
|
|
|
2024-02-06 01:29:58 +00:00
|
|
|
# Call on composer
|
2024-02-06 00:00:58 +00:00
|
|
|
echo " -> Installing dependencies using composer..."
|
|
|
|
/usr/bin/composer install --no-dev --no-cache --optimize-autoloader --no-progress -q || exit 0
|
|
|
|
|
2024-02-06 01:29:58 +00:00
|
|
|
# Call post-init script
|
2024-02-06 00:00:58 +00:00
|
|
|
if [ -f /application/.symfony-init ]; then
|
|
|
|
echo " -> Running container-provided .symfony-init script"
|
|
|
|
sh /application/.symfony-init
|
|
|
|
fi
|
|
|
|
|
2024-02-06 01:29:58 +00:00
|
|
|
echo " -> Setting up directories..."
|
|
|
|
test -d /application/var/cache/prod || ( mkdir -p /application/var/cache/prod && chmod a+rwx /application/var/cache/prod )
|
|
|
|
|
|
|
|
# Do some variant-specific setup
|
|
|
|
case "$VARIANT" in
|
|
|
|
"vanilla")
|
|
|
|
echo " -> Compiling .env for prodution..."
|
|
|
|
composer symfony:dump-env prod -q
|
|
|
|
echo " -> Clearing cache..."
|
|
|
|
bin/console cache:clear --env=prod -q
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2024-02-06 00:00:58 +00:00
|
|
|
echo " -> Testing environment..."
|
2024-02-06 00:31:34 +00:00
|
|
|
if bin/console about -q; then
|
2024-02-06 01:29:58 +00:00
|
|
|
echo " Successful"
|
2024-02-06 00:00:58 +00:00
|
|
|
else
|
|
|
|
echo " !! Failed"
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|