mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-22 17:33:12 +00:00
optimize docker build
This commit is contained in:
@@ -1,18 +1,33 @@
|
|||||||
/.circleci
|
.idea
|
||||||
/.git
|
|
||||||
.settings
|
.settings
|
||||||
/nodes_modules
|
/*.md
|
||||||
/vendor
|
/.circleci
|
||||||
/docker-compose.*
|
/.dockerignore
|
||||||
/Dockerfile
|
|
||||||
/.env
|
/.env
|
||||||
/.env.*
|
/.env.*
|
||||||
/*.md
|
/.git
|
||||||
/.travis.yml
|
/.travis.yml
|
||||||
|
/AUTHORS
|
||||||
/CONTRIBUTORS
|
/CONTRIBUTORS
|
||||||
|
/Dockerfile
|
||||||
/LICENSE
|
/LICENSE
|
||||||
/www/thumbnails
|
/bin
|
||||||
/www/assets
|
!/bin/console
|
||||||
/www/custom
|
!/bin/developer
|
||||||
|
!/bin/setup
|
||||||
|
/cache
|
||||||
/config/configuration.yml
|
/config/configuration.yml
|
||||||
/config/configuration-compiled.php
|
/config/configuration-compiled.php
|
||||||
|
!/config/configuration.sample.yml
|
||||||
|
/datas
|
||||||
|
/docker-compose.*
|
||||||
|
/logs
|
||||||
|
/nodes_modules
|
||||||
|
/plugins
|
||||||
|
/tmp
|
||||||
|
/vendor
|
||||||
|
/www/assets
|
||||||
|
/www/custom
|
||||||
|
/www/plugins
|
||||||
|
/www/thumbnails
|
||||||
|
npm-debug.log
|
||||||
|
2
.env
2
.env
@@ -52,7 +52,7 @@ MYSQL_MAX_ALLOWED_PACKET=16M
|
|||||||
# --- DEV purpose ---
|
# --- DEV purpose ---
|
||||||
|
|
||||||
# PhpMyAdmin port
|
# PhpMyAdmin port
|
||||||
PHPMYADMIN_PORT=8089
|
PHRASEANET_PHPMYADMIN_PORT=8089
|
||||||
|
|
||||||
# Xdebug
|
# Xdebug
|
||||||
XDEBUG_ENABLED=1
|
XDEBUG_ENABLED=1
|
||||||
|
12
Dockerfile
12
Dockerfile
@@ -93,7 +93,7 @@ RUN composer install --prefer-dist --no-dev --no-progress --no-suggest --classma
|
|||||||
|
|
||||||
COPY --chown=app . .
|
COPY --chown=app . .
|
||||||
|
|
||||||
RUN rm -rf docker \
|
RUN rm -rf docker/phraseanet/root \
|
||||||
&& make install
|
&& make install
|
||||||
|
|
||||||
ADD docker/phraseanet/ /
|
ADD docker/phraseanet/ /
|
||||||
@@ -105,9 +105,9 @@ ADD docker/phraseanet/ /
|
|||||||
FROM phraseanet-system as phraseanet-fpm
|
FROM phraseanet-system as phraseanet-fpm
|
||||||
|
|
||||||
COPY --from=builder --chown=app /var/alchemy/Phraseanet /var/alchemy/Phraseanet
|
COPY --from=builder --chown=app /var/alchemy/Phraseanet /var/alchemy/Phraseanet
|
||||||
ADD ./docker/phraseanet/ /
|
ADD ./docker/phraseanet/root /
|
||||||
WORKDIR /var/alchemy/Phraseanet
|
WORKDIR /var/alchemy/Phraseanet
|
||||||
ENTRYPOINT ["/phraseanet/entrypoint.sh"]
|
ENTRYPOINT ["docker/phraseanet/entrypoint.sh"]
|
||||||
CMD ["php-fpm", "-F"]
|
CMD ["php-fpm", "-F"]
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
@@ -115,8 +115,8 @@ CMD ["php-fpm", "-F"]
|
|||||||
#########################################################################
|
#########################################################################
|
||||||
|
|
||||||
FROM phraseanet-fpm as phraseanet-worker
|
FROM phraseanet-fpm as phraseanet-worker
|
||||||
ENTRYPOINT ["/phraseanet/worker/entrypoint.sh"]
|
ENTRYPOINT ["docker/phraseanet/worker/entrypoint.sh"]
|
||||||
CMD ["/phraseanet/worker/scheduler-run.sh"]
|
CMD ["docker/phraseanet/worker/scheduler-run.sh"]
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# phraseanet-nginx
|
# phraseanet-nginx
|
||||||
@@ -124,7 +124,7 @@ CMD ["/phraseanet/worker/scheduler-run.sh"]
|
|||||||
|
|
||||||
FROM nginx:1.17.8-alpine as phraseanet-nginx
|
FROM nginx:1.17.8-alpine as phraseanet-nginx
|
||||||
RUN adduser --uid 1000 --disabled-password app
|
RUN adduser --uid 1000 --disabled-password app
|
||||||
ADD ./docker/nginx/ /
|
ADD ./docker/nginx/root /
|
||||||
COPY --from=builder /var/alchemy/Phraseanet/www /var/alchemy/Phraseanet/www
|
COPY --from=builder /var/alchemy/Phraseanet/www /var/alchemy/Phraseanet/www
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
@@ -4,7 +4,7 @@ services:
|
|||||||
image: phpmyadmin/phpmyadmin
|
image: phpmyadmin/phpmyadmin
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
ports:
|
ports:
|
||||||
- ${PHPMYADMIN_PORT}:80
|
- ${PHRASEANET_PHPMYADMIN_PORT}:80
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ services:
|
|||||||
- .:/var/alchemy/Phraseanet
|
- .:/var/alchemy/Phraseanet
|
||||||
- ./datas:/var/alchemy/Phraseanet/datas:rw
|
- ./datas:/var/alchemy/Phraseanet/datas:rw
|
||||||
- ./www/thumbnails:/var/alchemy/Phraseanet/www/thumbnails:rw
|
- ./www/thumbnails:/var/alchemy/Phraseanet/www/thumbnails:rw
|
||||||
- ./docker/nginx/entrypoint.sh:/entrypoint.sh
|
- ./docker/nginx/root/entrypoint.sh:/entrypoint.sh
|
||||||
|
|
||||||
builder:
|
builder:
|
||||||
build:
|
build:
|
||||||
@@ -22,6 +22,10 @@ services:
|
|||||||
command: exit 0
|
command: exit 0
|
||||||
volumes:
|
volumes:
|
||||||
- .:/var/alchemy/Phraseanet
|
- .:/var/alchemy/Phraseanet
|
||||||
|
- ./config:/var/alchemy/Phraseanet/config:rw
|
||||||
|
- ./logs:/var/alchemy/Phraseanet/logs:rw
|
||||||
|
- ./datas:/var/alchemy/Phraseanet/datas:rw
|
||||||
|
- ./www/thumbnails:/var/alchemy/Phraseanet/www/thumbnails:rw
|
||||||
|
|
||||||
phraseanet:
|
phraseanet:
|
||||||
environment:
|
environment:
|
||||||
@@ -34,8 +38,6 @@ services:
|
|||||||
- ./logs:/var/alchemy/Phraseanet/logs:rw
|
- ./logs:/var/alchemy/Phraseanet/logs:rw
|
||||||
- ./datas:/var/alchemy/Phraseanet/datas:rw
|
- ./datas:/var/alchemy/Phraseanet/datas:rw
|
||||||
- ./www/thumbnails:/var/alchemy/Phraseanet/www/thumbnails:rw
|
- ./www/thumbnails:/var/alchemy/Phraseanet/www/thumbnails:rw
|
||||||
- ./docker/phraseanet/phraseanet/entrypoint.sh:/phraseanet/entrypoint.sh
|
|
||||||
- ./docker/phraseanet/phraseanet/auto-install.sh:/phraseanet/auto-install.sh
|
|
||||||
|
|
||||||
worker:
|
worker:
|
||||||
volumes:
|
volumes:
|
||||||
@@ -44,9 +46,6 @@ services:
|
|||||||
- ./logs:/var/alchemy/Phraseanet/logs:rw
|
- ./logs:/var/alchemy/Phraseanet/logs:rw
|
||||||
- ./datas:/var/alchemy/Phraseanet/datas:rw
|
- ./datas:/var/alchemy/Phraseanet/datas:rw
|
||||||
- ./www/thumbnails:/var/alchemy/Phraseanet/www/thumbnails:rw
|
- ./www/thumbnails:/var/alchemy/Phraseanet/www/thumbnails:rw
|
||||||
- ./docker/phraseanet/phraseanet/entrypoint.sh:/phraseanet/entrypoint.sh
|
|
||||||
- ./docker/phraseanet/phraseanet/worker/entrypoint.sh:/phraseanet/worker/entrypoint.sh
|
|
||||||
- ./docker/phraseanet/phraseanet/worker/scheduler-run.sh:/phraseanet/worker/scheduler-run.sh
|
|
||||||
|
|
||||||
rabbitmq:
|
rabbitmq:
|
||||||
ports:
|
ports:
|
||||||
@@ -67,4 +66,3 @@ networks:
|
|||||||
ipam:
|
ipam:
|
||||||
config:
|
config:
|
||||||
- subnet: $PHRASEANET_SUBNET_IPS
|
- subnet: $PHRASEANET_SUBNET_IPS
|
||||||
|
|
||||||
|
@@ -1,7 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -xe
|
|
||||||
|
|
||||||
cat nginx.conf.sample | sed "s/\$MAX_BODY_SIZE/$MAX_BODY_SIZE/g" > /etc/nginx/conf.d/default.conf
|
|
||||||
|
|
||||||
exec "$@"
|
|
7
docker/nginx/root/entrypoint.sh
Executable file
7
docker/nginx/root/entrypoint.sh
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -xe
|
||||||
|
|
||||||
|
cat /nginx.conf.sample | sed "s/\$MAX_BODY_SIZE/$MAX_BODY_SIZE/g" > /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
|
exec "$@"
|
@@ -1,9 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if [ ! -z ${DOCKER_XDEBUG_ENABLED} ]; then
|
|
||||||
. usr-bin/docker-xdebug-enable
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec "$@"
|
|
@@ -1,4 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
/sbin/ip route|awk '/default/ { print $3 }'
|
|
||||||
# TODO support MacOS & Windows host IP
|
|
@@ -1,5 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
unset HOST_IP
|
|
||||||
unset XDEBUG_CONFIG
|
|
||||||
unset XDEBUG_REMOTE_HOST
|
|
@@ -1,9 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
HOST_IP=$(docker-get-host-ip);
|
|
||||||
|
|
||||||
export HOST_IP
|
|
||||||
export XDEBUG_CONFIG="remote_enable=1 remote_host=${HOST_IP} idekey=PHPSTORM";
|
|
||||||
export XDEBUG_REMOTE_HOST="${HOST_IP}";
|
|
@@ -2,12 +2,12 @@
|
|||||||
|
|
||||||
set -xe
|
set -xe
|
||||||
|
|
||||||
if [ $INSTALL_ACCOUNT_EMAIL = ""]; then
|
if [ -z "$INSTALL_ACCOUNT_EMAIL" ]; then
|
||||||
echo "INSTALL_ACCOUNT_EMAIL var is not set."
|
echo "INSTALL_ACCOUNT_EMAIL var is not set."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $INSTALL_ACCOUNT_PASSWORD = ""]; then
|
if [ -z "$INSTALL_ACCOUNT_PASSWORD" ]; then
|
||||||
echo "INSTALL_ACCOUNT_PASSWORD var is not set."
|
echo "INSTALL_ACCOUNT_PASSWORD var is not set."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -39,7 +39,6 @@ fi
|
|||||||
/var/alchemy/Phraseanet/bin/setup system:config set main.cache.type redis
|
/var/alchemy/Phraseanet/bin/setup system:config set main.cache.type redis
|
||||||
|
|
||||||
# RabbitMQ
|
# RabbitMQ
|
||||||
|
|
||||||
bin/setup system:config set rabbitmq.server.host 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.port 5672
|
||||||
bin/setup system:config set rabbitmq.server.user $INSTALL_RABBITMQ_USER
|
bin/setup system:config set rabbitmq.server.user $INSTALL_RABBITMQ_USER
|
29
docker/phraseanet/entrypoint.sh
Executable file
29
docker/phraseanet/entrypoint.sh
Executable 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 $@
|
@@ -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 $@
|
|
@@ -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 $@
|
|
@@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
runuser app -c 'php /var/alchemy/Phraseanet/bin/console task-manager:scheduler:run'
|
|
18
docker/phraseanet/worker/entrypoint.sh
Executable file
18
docker/phraseanet/worker/entrypoint.sh
Executable 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 $@
|
3
docker/phraseanet/worker/scheduler-run.sh
Executable file
3
docker/phraseanet/worker/scheduler-run.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
runuser app -c 'php bin/console task-manager:scheduler:run'
|
@@ -474,6 +474,17 @@ class Basket extends \Alchemy\Phrasea\Model\Entities\Basket implements \Doctrine
|
|||||||
return parent::hasRecord($app, $record);
|
return parent::hasRecord($app, $record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function getElementByRecord(\Alchemy\Phrasea\Application $app, \record_adapter $record)
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->__initializer__ && $this->__initializer__->__invoke($this, 'getElementByRecord', [$app, $record]);
|
||||||
|
|
||||||
|
return parent::getElementByRecord($app, $record);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
@@ -518,4 +518,15 @@ class LazaretFile extends \Alchemy\Phrasea\Model\Entities\LazaretFile implements
|
|||||||
return parent::getRecordsToSubstitute($app, $includeReason);
|
return parent::getRecordsToSubstitute($app, $includeReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function getStatus(\Alchemy\Phrasea\Application $app)
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->__initializer__ && $this->__initializer__->__invoke($this, 'getStatus', [$app]);
|
||||||
|
|
||||||
|
return parent::getStatus($app);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user