mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 01:43:13 +00:00
arrange entrypoints and commands for docker
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
/docker-compose.*
|
/docker-compose.*
|
||||||
/Dockerfile
|
/Dockerfile
|
||||||
/.env
|
/.env
|
||||||
|
/.env.*
|
||||||
/*.md
|
/*.md
|
||||||
/.travis.yml
|
/.travis.yml
|
||||||
/CONTRIBUTORS
|
/CONTRIBUTORS
|
||||||
@@ -13,3 +14,5 @@
|
|||||||
/www/thumbnails
|
/www/thumbnails
|
||||||
/www/assets
|
/www/assets
|
||||||
/www/custom
|
/www/custom
|
||||||
|
/config/configuration.yml
|
||||||
|
/config/configuration-compiled.php
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@@ -71,3 +71,5 @@ playbook.retry
|
|||||||
npm-debug.log
|
npm-debug.log
|
||||||
|
|
||||||
/Phrasea_datas
|
/Phrasea_datas
|
||||||
|
|
||||||
|
.env.*
|
||||||
|
12
Dockerfile
12
Dockerfile
@@ -107,15 +107,16 @@ 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/ /
|
||||||
WORKDIR /var/alchemy/Phraseanet
|
WORKDIR /var/alchemy/Phraseanet
|
||||||
ENTRYPOINT ["/phraseanet-entrypoint.sh"]
|
ENTRYPOINT ["/phraseanet/entrypoint.sh"]
|
||||||
CMD ["/boot.sh"]
|
CMD ["php-fpm", "-F"]
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# Phraseanet worker application image
|
# Phraseanet worker application image
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
|
||||||
FROM phraseanet-fpm as phraseanet-worker
|
FROM phraseanet-fpm as phraseanet-worker
|
||||||
CMD ["/worker-boot.sh"]
|
ENTRYPOINT ["/phraseanet/worker/entrypoint.sh"]
|
||||||
|
CMD ["/phraseanet/worker/scheduler-run.sh"]
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# phraseanet-nginx
|
# phraseanet-nginx
|
||||||
@@ -125,4 +126,7 @@ 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/ /
|
||||||
COPY --from=builder /var/alchemy/Phraseanet/www /var/alchemy/Phraseanet/www
|
COPY --from=builder /var/alchemy/Phraseanet/www /var/alchemy/Phraseanet/www
|
||||||
CMD ["/boot.sh"]
|
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
|
19
README.md
19
README.md
@@ -52,6 +52,16 @@ export INSTALL_ACCOUNT_PASSWORD=$3cr3t!
|
|||||||
export PHRASEANET_APP_PORT=8082
|
export PHRASEANET_APP_PORT=8082
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Using a .env.local
|
||||||
|
|
||||||
|
It may be easier to deal with a local file to manage our env variables.
|
||||||
|
|
||||||
|
You can add your `.env.local` at the root of this project and define a command alias in your `~/.bashrc`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
alias dc="env $(cat .env.local | grep -v '#' | tr '\n' ' ') docker-compose"
|
||||||
|
```
|
||||||
|
|
||||||
### Running the application
|
### Running the application
|
||||||
|
|
||||||
If you are not interested in the development of Phraseanet, you can ignore everything in `.env` after the `DEV Purpose` part.
|
If you are not interested in the development of Phraseanet, you can ignore everything in `.env` after the `DEV Purpose` part.
|
||||||
@@ -103,15 +113,6 @@ For PhpStorm, you can follow this example:
|
|||||||
> Configure the `Absolute path on the server` to `/var/alchemy/Phraseanet` at the project root path (i.e. `~/projects/Phraseanet`).
|
> Configure the `Absolute path on the server` to `/var/alchemy/Phraseanet` at the project root path (i.e. `~/projects/Phraseanet`).
|
||||||
|
|
||||||
|
|
||||||
### How to change volumes location
|
|
||||||
|
|
||||||
Before moving all the files, or to use a different location, you have to remove all containers and volume definitions with the following command :
|
|
||||||
|
|
||||||
docker-compose down --volumes
|
|
||||||
|
|
||||||
Then move the files and set the `VOLUMES_DIR` to the new location.
|
|
||||||
|
|
||||||
|
|
||||||
# With Vagrant (deprecated)
|
# With Vagrant (deprecated)
|
||||||
|
|
||||||
## Development :
|
## Development :
|
||||||
|
@@ -13,6 +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
|
||||||
|
|
||||||
builder:
|
builder:
|
||||||
build:
|
build:
|
||||||
@@ -33,6 +34,8 @@ 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:
|
||||||
@@ -41,6 +44,9 @@ 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:
|
||||||
|
@@ -14,7 +14,6 @@ services:
|
|||||||
- phraseanet
|
- phraseanet
|
||||||
environment:
|
environment:
|
||||||
- MAX_BODY_SIZE
|
- MAX_BODY_SIZE
|
||||||
|
|
||||||
ports:
|
ports:
|
||||||
- ${PHRASEANET_APP_PORT}:80
|
- ${PHRASEANET_APP_PORT}:80
|
||||||
|
|
||||||
|
@@ -3,4 +3,5 @@
|
|||||||
set -xe
|
set -xe
|
||||||
|
|
||||||
cat nginx.conf.sample | sed "s/\$MAX_BODY_SIZE/$MAX_BODY_SIZE/g" > /etc/nginx/conf.d/default.conf
|
cat nginx.conf.sample | sed "s/\$MAX_BODY_SIZE/$MAX_BODY_SIZE/g" > /etc/nginx/conf.d/default.conf
|
||||||
nginx -g "daemon off;"
|
|
||||||
|
exec "$@"
|
@@ -1,17 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -xe
|
|
||||||
|
|
||||||
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 exist, skip setup."
|
|
||||||
else
|
|
||||||
echo "$FILE doesn't exist, entering setup..."
|
|
||||||
runuser app -c '/auto-install.sh'
|
|
||||||
fi
|
|
||||||
|
|
||||||
php-fpm -F
|
|
25
docker/phraseanet/phraseanet/entrypoint.sh
Executable file
25
docker/phraseanet/phraseanet/entrypoint.sh
Executable file
@@ -0,0 +1,25 @@
|
|||||||
|
#!/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 $@
|
@@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
set -e
|
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.ini.sample > /usr/local/etc/php/php.ini
|
||||||
envsubst < /php-fpm.conf.sample > /usr/local/etc/php-fpm.conf
|
envsubst < /php-fpm.conf.sample > /usr/local/etc/php-fpm.conf
|
||||||
|
|
3
docker/phraseanet/phraseanet/worker/scheduler-run.sh
Executable file
3
docker/phraseanet/phraseanet/worker/scheduler-run.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
runuser app -c 'php /var/alchemy/Phraseanet/bin/console task-manager:scheduler:run'
|
@@ -1,9 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ ${XDEBUG_ENABLED} == "1" ]; then
|
|
||||||
echo "XDEBUG is enabled. YOU MAY KEEP THIS FEATURE DISABLED IN PRODUCTION."
|
|
||||||
docker-php-ext-enable xdebug
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir /var/alchemy/Phraseanet/tmp/locks && chown -R app:app /var/alchemy/Phraseanet/tmp
|
|
||||||
runuser app -c 'php /var/alchemy/Phraseanet/bin/console task-manager:scheduler:run'
|
|
Reference in New Issue
Block a user