docker-alpine-php83-aio/config/frameworks/10-symfony.sh

49 lines
1.3 KiB
Bash
Raw Normal View History

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-07 12:37:27 +00:00
echo " => Detected Symfony (Bolt) project"
2024-02-06 00:31:34 +00:00
VARIANT=bolt
else
2024-02-07 12:37:27 +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-16 01:28:13 +00:00
# Call on composer if no vendor dir
if [ ! -d /application/vendor ]; then
echo " -> Installing dependencies using composer..."
/usr/bin/composer install --no-dev --no-cache --optimize-autoloader --no-progress -q || exit 0
fi
2024-02-06 00:00:58 +00:00
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 )
2024-02-16 01:28:13 +00:00
echo " -> Compiling .env for prodution..."
composer symfony:dump-env prod -q
echo " -> Clearing cache..."
bin/console cache:clear --env=prod -q
2024-02-08 11:40:11 +00:00
2024-02-06 00:00:58 +00:00
echo " -> Testing environment..."
2024-02-06 02:06:27 +00:00
if ! bin/console about -q; then
2024-02-07 12:37:27 +00:00
echo " ** Failed **"
2024-02-06 00:00:58 +00:00
fi
exit 0