optimize docker build

This commit is contained in:
Arthur de Moulins
2020-02-28 15:46:19 +01:00
parent 4cfc712674
commit 4a634070d1
23 changed files with 119 additions and 106 deletions

View File

@@ -2,12 +2,12 @@
set -xe
if [ $INSTALL_ACCOUNT_EMAIL = ""]; then
if [ -z "$INSTALL_ACCOUNT_EMAIL" ]; then
echo "INSTALL_ACCOUNT_EMAIL var is not set."
exit 1
fi
if [ $INSTALL_ACCOUNT_PASSWORD = ""]; then
if [ -z "$INSTALL_ACCOUNT_PASSWORD" ]; then
echo "INSTALL_ACCOUNT_PASSWORD var is not set."
exit 1
fi
@@ -39,7 +39,6 @@ fi
/var/alchemy/Phraseanet/bin/setup system:config set main.cache.type redis
# RabbitMQ
bin/setup system:config set rabbitmq.server.host rabbitmq
bin/setup system:config set rabbitmq.server.port 5672
bin/setup system:config set rabbitmq.server.user $INSTALL_RABBITMQ_USER

29
docker/phraseanet/entrypoint.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/bash
set -e
envsubst < "docker/phraseanet/php.ini.sample" > /usr/local/etc/php/php.ini
envsubst < "docker/phraseanet/php-fpm.conf.sample" > /usr/local/etc/php-fpm.conf
chown -R app:app \
config \
datas \
tmp \
logs \
www/thumbnails
FILE=config/configuration.yml
if [ -f "$FILE" ]; then
echo "$FILE exists, skip setup."
else
echo "$FILE doesn't exist, entering setup..."
runuser app -c docker/phraseanet/auto-install.sh
fi
if [ ${XDEBUG_ENABLED} == "1" ]; then
echo "XDEBUG is enabled. YOU MAY KEEP THIS FEATURE DISABLED IN PRODUCTION."
docker-php-ext-enable xdebug
fi
bash -e docker-php-entrypoint $@

View File

@@ -1,25 +0,0 @@
#!/bin/bash
set -e
envsubst < /php.ini.sample > /usr/local/etc/php/php.ini
envsubst < /php-fpm.conf.sample > /usr/local/etc/php-fpm.conf
chown -R app:app /var/alchemy/Phraseanet/config
chown -R app:app /var/alchemy/Phraseanet/datas
chown -R app:app /var/alchemy/Phraseanet/tmp
chown -R app:app /var/alchemy/Phraseanet/www/thumbnails
FILE=/var/alchemy/Phraseanet/config/configuration.yml
if [ -f "$FILE" ]; then
echo "$FILE exists, skip setup."
else
echo "$FILE doesn't exist, entering setup..."
runuser app -c '/phraseanet/auto-install.sh'
fi
if [ ${XDEBUG_ENABLED} == "1" ]; then
echo "XDEBUG is enabled. YOU MAY KEEP THIS FEATURE DISABLED IN PRODUCTION."
docker-php-ext-enable xdebug
fi
bash -e docker-php-entrypoint $@

View File

@@ -1,16 +0,0 @@
#!/bin/bash
set -e
mkdir -p /var/alchemy/Phraseanet/tmp/locks \
&& chown -R app:app /var/alchemy/Phraseanet/tmp
envsubst < /php.ini.sample > /usr/local/etc/php/php.ini
envsubst < /php-fpm.conf.sample > /usr/local/etc/php-fpm.conf
if [ ${XDEBUG_ENABLED} == "1" ]; then
echo "XDEBUG is enabled. YOU MAY KEEP THIS FEATURE DISABLED IN PRODUCTION."
docker-php-ext-enable xdebug
fi
bash -e docker-php-entrypoint $@

View File

@@ -1,3 +0,0 @@
#!/bin/bash
runuser app -c 'php /var/alchemy/Phraseanet/bin/console task-manager:scheduler:run'

View File

@@ -0,0 +1,18 @@
#!/bin/bash
set -e
DOCKER_DIR="./docker/phraseanet"
mkdir -p "${APP_DIR}/tmp/locks" \
&& chown -R app:app "${APP_DIR}/tmp"
envsubst < "${DOCKER_DIR}/php.ini.sample" > /usr/local/etc/php/php.ini
envsubst < "${DOCKER_DIR}/php-fpm.conf.sample" > /usr/local/etc/php-fpm.conf
if [ ${XDEBUG_ENABLED} == "1" ]; then
echo "XDEBUG is enabled. YOU MAY KEEP THIS FEATURE DISABLED IN PRODUCTION."
docker-php-ext-enable xdebug
fi
bash -e docker-php-entrypoint $@

View File

@@ -0,0 +1,3 @@
#!/bin/bash
runuser app -c 'php bin/console task-manager:scheduler:run'