From d41268ea66a7c9644da8ce899881d9b1429a24e7 Mon Sep 17 00:00:00 2001 From: Arthur de Moulins Date: Fri, 21 Feb 2020 17:29:45 +0100 Subject: [PATCH] arrange volumes --- .dockerignore | 1 - .env | 3 --- .gitignore | 2 -- Dockerfile | 13 ++++----- Makefile | 5 +++- README.md | 45 ++++++++++++++++--------------- docker-compose.override.yml | 53 ++++--------------------------------- docker-compose.yml | 8 ------ docker/nginx/boot.sh | 2 +- 9 files changed, 40 insertions(+), 92 deletions(-) diff --git a/.dockerignore b/.dockerignore index 8a59e7871a..5331a360a7 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,7 +3,6 @@ .settings /nodes_modules /vendor -/volumes /docker-compose.* /Dockerfile /.env diff --git a/.env b/.env index 00198290f3..de8904cafd 100644 --- a/.env +++ b/.env @@ -56,9 +56,6 @@ MYSQL_MAX_ALLOWED_PACKET=16M # PhpMyAdmin port PHPMYADMIN_PORT=8089 -# Mount local volumes -PHRASEANET_VOLUMES_DIR=./volumes - # Xdebug XDEBUG_ENABLED=1 XDEBUG_PROFILER_ENABLED=0 diff --git a/.gitignore b/.gitignore index 3fd4cc470b..dc81372af0 100644 --- a/.gitignore +++ b/.gitignore @@ -71,5 +71,3 @@ playbook.retry npm-debug.log /Phrasea_datas - -/volumes diff --git a/Dockerfile b/Dockerfile index 594703a9a3..10443b9f88 100644 --- a/Dockerfile +++ b/Dockerfile @@ -77,23 +77,24 @@ RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \ nodejs \ yarn \ && apt-get clean \ - && rm -rf /var/lib/apt/lists + && rm -rf /var/lib/apt/lists \ + && mkdir -p /var/alchemy/Phraseanet \ + && chown -R app:app /var/alchemy WORKDIR /var/alchemy/Phraseanet +USER app + # Warm up composer cache for faster builds COPY docker/caching/composer.* ./ RUN composer install --prefer-dist --no-dev --no-progress --no-suggest --classmap-authoritative --no-interaction --no-scripts \ && rm -rf vendor composer.* # End warm up -COPY . . +COPY --chown=app . . RUN rm -rf docker \ - && make install_composer \ - && make clean_assets \ - && make install_asset_dependencies \ - && make install_assets + && make install ADD docker/phraseanet/ / diff --git a/Makefile b/Makefile index 192ae889bb..1627d6356d 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,10 @@ install: make install_assets install_composer: - composer install --ignore-platform-reqs + composer install --ignore-platform-reqs --no-dev --no-suggest --classmap-authoritative --no-interaction + +install_composer_dev: + composer install install_asset_dependencies: yarn install diff --git a/README.md b/README.md index f16622602f..3a3971614a 100644 --- a/README.md +++ b/README.md @@ -32,26 +32,6 @@ You can also download a testing pre installed Virtual Machine in OVA format here https://www.phraseanet.com/download/ -# Development : - -For development purpose Phraseanet is shipped with ready to use development environments using vagrant. -You can easily choose betweeen a complete build or a prebuild box, with a specific PHP version. - - git clone - vagrant up --provision - -then, a prompt allow you to choose PHP version, and another one to choose a complete build or an Alchemy prebuilt boxes. - -Ex: -- vagrant up --provision //// 5.6 ///// 1 >> Build an ubuntu/xenial box with php5.6 -- vagrant up --provision //// 7.0 ///// 1 >> Build an ubuntu/xenial with php7.0 -- vagrant up --provision //// 7.2 ///// 2 >> Build the alchemy/phraseanet-php-7.2 box -- vagrant up --provision //// 5.6 ///// 1 >> Build the alchemy/phraseanet-php-5.6 box - - -For development with Phraseanet API see https://docs.phraseanet.com/4.0/en/Devel/index.html - - # With Docker ## Prerequisites @@ -67,7 +47,6 @@ Use `export` to override these values. i.e: ```bash export PHRASEANET_DOCKER_TAG=latest -export PHRASEANET_VOLUMES_DIR=/path/to/my/custom/dir export INSTALL_ACCOUNT_EMAIL=foo@bar.com export INSTALL_ACCOUNT_PASSWORD=$3cr3t! export PHRASEANET_APP_PORT=8082 @@ -100,7 +79,7 @@ The environment is not ready yet: you have to fetch all dependencies. This can be made easily from the builder container: - docker-compose exec -u app builder make + docker-compose run --rm -u app builder make install install_composer_dev > Please note that the phraseanet image does not contain nor `composer` neither `node` tools. This allow the final image to be slim. > If you need to use dev tools, ensure you are running the `builder` image! @@ -131,3 +110,25 @@ Before moving all the files, or to use a different location, you have to remove docker-compose down --volumes Then move the files and set the `VOLUMES_DIR` to the new location. + + +# With Vagrant (deprecated) + +## Development : + +For development purpose Phraseanet is shipped with ready to use development environments using vagrant. +You can easily choose betweeen a complete build or a prebuild box, with a specific PHP version. + + git clone + vagrant up --provision + +then, a prompt allow you to choose PHP version, and another one to choose a complete build or an Alchemy prebuilt boxes. + +Ex: +- vagrant up --provision //// 5.6 ///// 1 >> Build an ubuntu/xenial box with php5.6 +- vagrant up --provision //// 7.0 ///// 1 >> Build an ubuntu/xenial with php7.0 +- vagrant up --provision //// 7.2 ///// 2 >> Build the alchemy/phraseanet-php-7.2 box +- vagrant up --provision //// 5.6 ///// 1 >> Build the alchemy/phraseanet-php-5.6 box + + +For development with Phraseanet API see https://docs.phraseanet.com/4.0/en/Devel/index.html diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 69306401cb..973c4a4519 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -10,13 +10,15 @@ services: gateway: volumes: - - .:/var/alchemy + - .:/var/alchemy/Phraseanet builder: build: context: . target: builder command: exit 0 + volumes: + - .:/var/alchemy/Phraseanet phraseanet: environment: @@ -24,11 +26,11 @@ services: - XDEBUG_CONFIG=remote_host=${PHRASEANET_GATEWAY_IP} idekey=${IDE_KEY} remote_enable=1 profiler_enable=${XDEBUG_PROFILER_ENABLED} profiler_output_dir=/var/alchemy/Phraseanet/cache/profiler - PHP_IDE_CONFIG volumes: - - .:/var/alchemy + - .:/var/alchemy/Phraseanet worker: volumes: - - .:/var/alchemy + - .:/var/alchemy/Phraseanet rabbitmq: ports: @@ -49,48 +51,3 @@ networks: ipam: config: - subnet: $PHRASEANET_SUBNET_IPS - -volumes: - data_vol: - driver: local - driver_opts: - type: none - device: $PHRASEANET_VOLUMES_DIR/data - o: bind - db_vol: - driver: local - driver_opts: - type: none - device: $PHRASEANET_VOLUMES_DIR/db - o: bind - elasticsearch_vol: - driver: local - driver_opts: - type: none - device: $PHRASEANET_VOLUMES_DIR/elasticsearch - o: bind - config_vol: - driver: local - driver_opts: - type: none - device: $PHRASEANET_VOLUMES_DIR/config - o: bind - custom_vol: - driver: local - driver_opts: - type: none - device: $PHRASEANET_VOLUMES_DIR/custom - o: bind - thumbnails_vol: - driver: local - driver_opts: - type: none - device: $PHRASEANET_VOLUMES_DIR/thumbnails - o: bind - # to be replacer by stdout/stderr - logs_vol: - driver: local - driver_opts: - type: none - device: $PHRASEANET_VOLUMES_DIR/logs - o: bind diff --git a/docker-compose.yml b/docker-compose.yml index 197f324699..89e2ef9835 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,7 +9,6 @@ services: restart: on-failure volumes: - data_vol:/var/alchemy/Phraseanet/datas:rw - - custom_vol:/var/alchemy/Phraseanet/www/custom:rw - thumbnails_vol:/var/alchemy/Phraseanet/www/thumbnails:rw depends_on: - phraseanet @@ -50,11 +49,9 @@ services: - INSTALL_RABBITMQ_PASSWORD=$RABBITMQ_DEFAULT_PASS volumes: - data_vol:/var/alchemy/Phraseanet/datas:rw - - config_vol:/var/alchemy/Phraseanet/config:rw - tmp_vol:/var/alchemy/Phraseanet/tmp:rw - logs_vol:/var/alchemy/Phraseanet/logs:rw - thumbnails_vol:/var/alchemy/Phraseanet/www/thumbnails:rw - - custom_vol:/var/alchemy/Phraseanet/www/custom:rw worker: build: @@ -75,7 +72,6 @@ services: - PHP_LOG_LEVEL volumes: - data_vol:/var/alchemy/Phraseanet/datas:rw - - config_vol:/var/alchemy/Phraseanet/config:rw - tmp_vol:/var/alchemy/Phraseanet/tmp:rw - logs_vol:/var/alchemy/Phraseanet/logs:rw - thumbnails_vol:/var/alchemy/Phraseanet/www/thumbnails:rw @@ -117,10 +113,6 @@ volumes: driver: local elasticsearch_vol: driver: local - config_vol: - driver: local - custom_vol: - driver: local thumbnails_vol: driver: local # to be replacer by stdout/stderr diff --git a/docker/nginx/boot.sh b/docker/nginx/boot.sh index 2684d8c0f7..c25c541c71 100755 --- a/docker/nginx/boot.sh +++ b/docker/nginx/boot.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh set -xe