mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Replace debian-based image with alpine-based.
Remove supervisor usage. Cron now runs as separate service. CI for backend now performs without Docker.
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
mkdir -p api/runtime api/web/assets console/runtime
|
||||
chown www-data:www-data api/runtime api/web/assets console/runtime
|
||||
|
||||
if [ "$YII_ENV" = "test" ]
|
||||
then
|
||||
YII_EXEC="/var/www/html/tests/codeception/bin/yii"
|
||||
else
|
||||
YII_EXEC="/var/www/html/yii"
|
||||
fi
|
||||
|
||||
if ! cmp -s ./../vendor/autoload.php ./vendor/autoload.php
|
||||
then
|
||||
echo "Vendor have diffs"
|
||||
echo "Removing not bundled vendor..."
|
||||
rm -rf ./vendor
|
||||
echo "Copying new one..."
|
||||
cp -r ./../vendor ./vendor
|
||||
fi
|
||||
|
||||
# Переносим dist, если его нету или он изменился (или затёрся силами volume)
|
||||
if ! cmp -s ./../dist/index.html ./frontend/dist/index.html
|
||||
then
|
||||
echo "Frontend dist have diffs"
|
||||
echo "Removing not bundled dist..."
|
||||
rm -rf ./frontend/dist
|
||||
echo "Copying new one..."
|
||||
cp -r ./../dist ./frontend/dist
|
||||
fi
|
||||
|
||||
# Генерируем правила RBAC
|
||||
echo "Generating RBAC rules"
|
||||
php $YII_EXEC rbac/generate
|
||||
|
||||
if [ "$YII_ENV" != "test" ]
|
||||
then
|
||||
wait-for-it "${DB_HOST:-db}:3306" -s -t 0 -- "php $YII_EXEC migrate/up --interactive=0"
|
||||
else
|
||||
wait-for-it "${DB_HOST:-testdb}:3306" -s -t 0 -- "php $YII_EXEC migrate/up --interactive=0"
|
||||
fi
|
||||
62
docker/php/docker-entrypoint.sh
Executable file
62
docker/php/docker-entrypoint.sh
Executable file
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
XDEBUG_EXTENSION_FILE="/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"
|
||||
PHP_PROD_INI="/usr/local/etc/php/conf.d/php.prod.ini"
|
||||
PHP_DEV_INI="/usr/local/etc/php/conf.d/php.dev.ini"
|
||||
|
||||
if [ "$YII_DEBUG" = "true" ] || [ "$YII_DEBUG" = "1" ] ; then
|
||||
echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > $XDEBUG_EXTENSION_FILE
|
||||
mv ${PHP_PROD_INI}{,.disabled} 2> /dev/null || true
|
||||
mv ${PHP_DEV_INI}{.disabled,} 2> /dev/null || true
|
||||
else
|
||||
rm -f $XDEBUG_EXTENSION_FILE
|
||||
mv ${PHP_DEV_INI}{,.disabled} 2> /dev/null || true
|
||||
mv ${PHP_PROD_INI}{.disabled,} 2> /dev/null || true
|
||||
fi
|
||||
|
||||
cd /var/www/html
|
||||
|
||||
# Create all necessary folders
|
||||
mkdir -p api/runtime api/web/assets console/runtime
|
||||
chown -R www-data:www-data api/runtime api/web/assets console/runtime
|
||||
|
||||
if [ "$YII_ENV" = "test" ]
|
||||
then
|
||||
YII_EXEC="/var/www/html/tests/codeception/bin/yii"
|
||||
else
|
||||
YII_EXEC="/var/www/html/yii"
|
||||
fi
|
||||
|
||||
# Fix permissions for cron tasks
|
||||
chmod 644 /etc/cron.d/*
|
||||
|
||||
if [ "$1" = "crond" ] ; then
|
||||
# see: https://github.com/dubiousjim/dcron/issues/13
|
||||
# ignore using `exec` for `dcron` to get another pid instead of `1`
|
||||
# exec "$@"
|
||||
"$@"
|
||||
fi
|
||||
|
||||
if [ "$1" = "yii" ] ; then
|
||||
shift
|
||||
php $YII_EXEC "$@"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "sh" ] || [ "$1" = "bash" ] || [ "$1" = "composer" ] || [ "$1" = "php" ] ; then
|
||||
exec "$@"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Generating RBAC rules"
|
||||
php $YII_EXEC rbac/generate
|
||||
|
||||
if [ "$YII_ENV" != "test" ]
|
||||
then
|
||||
wait-for-it "${DB_HOST:-db}:3306" -s -t 0 -- "php $YII_EXEC migrate/up --interactive=0"
|
||||
else
|
||||
wait-for-it "${DB_HOST:-testdb}:3306" -s -t 0 -- "php $YII_EXEC migrate/up --interactive=0"
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
5
docker/php/php.dev.ini
Normal file
5
docker/php/php.dev.ini
Normal file
@@ -0,0 +1,5 @@
|
||||
error_reporting = E_ALL;
|
||||
display_errors = On;
|
||||
|
||||
# Disable Opcache caching
|
||||
opcache.validate_timestamps = 1;
|
||||
14
docker/php/php.prod.ini
Normal file
14
docker/php/php.prod.ini
Normal file
@@ -0,0 +1,14 @@
|
||||
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
|
||||
display_errors = Off
|
||||
display_startup_errors = Off
|
||||
log_errors = On
|
||||
html_errors = Off
|
||||
expose_php = Off
|
||||
|
||||
# Opcache tuning
|
||||
opcache.revalidate_freq = 0
|
||||
opcache.validate_timestamps = 0
|
||||
opcache.max_accelerated_files = 7963
|
||||
opcache.memory_consumption = 192
|
||||
opcache.interned_strings_buffer = 16
|
||||
opcache.fast_shutdown = 1
|
||||
Reference in New Issue
Block a user