docker-alpine-php83-aio/config/frameworks/10-symfony.sh
Christopher Vagnetoft fadcb3556b
All checks were successful
dockerbuild / Build docker image (push) Successful in 1m34s
Bolt fixes
2024-02-08 12:40:11 +01:00

64 lines
1.7 KiB
Bash

#!/bin/sh
# If there is no symfony.lock file, this isn't a symfony project
if [ ! -f /application/symfony.lock ]; then
exit 1
fi
# Determine if this is a specific variant of Symfny
if [ -d /application/config/bolt ]; then
echo " => Detected Symfony (Bolt) project"
VARIANT=bolt
else
echo " => Detected Symfony project"
VARIANT=vanilla
fi
# Call pre-init script
if [ -f /application/.symfony-preinit ]; then
echo " -> Running container-provided .symfony-preinit script"
sh /application/.symfony-preinit
fi
# Call on composer
echo " -> Installing dependencies using composer..."
/usr/bin/composer install --no-dev --no-cache --optimize-autoloader --no-progress -q || exit 0
# Call post-init script
if [ -f /application/.symfony-init ]; then
echo " -> Running container-provided .symfony-init script"
sh /application/.symfony-init
fi
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
;;
"bolt")
echo " -> Setting up BoltCMS directories..."
# we get a warning about this
chmod a+rwx /application/config
# we don't want to get errors from these
chmod -R a+rwx /application/var
chmod -R a+rwx /application/var/data
chmod -R a+rwx /application/var/cache
chmod -R a+rwx /application/var/cache/prod
chmod -R a+rwx /application/var/log
;;
esac
echo " -> Testing environment..."
if ! bin/console about -q; then
echo " ** Failed **"
fi
exit 0