From 953843c48f71ad314aa9a61243be34195997f6d0 Mon Sep 17 00:00:00 2001 From: Pascal Date: Wed, 7 Nov 2018 09:54:23 +0100 Subject: [PATCH 1/5] Add missing cd statement --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 889d1ca..6e63cd4 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ Because ``docker-compose.yml`` uses Compose file format 2.1 at least **Docker ve ``` git clone https://github.com/sylius/docker sylius-docker +cd sylius-docker make help make up make console CMD=sylius:install From a48f2b81aa4c3c2c12c0b27fed63e0e7b19abedd Mon Sep 17 00:00:00 2001 From: TiMESPLiNTER Date: Wed, 7 Nov 2018 16:08:13 +0100 Subject: [PATCH 2/5] wip --- .env | 1 + Dockerfile | 39 ++++++++++++++++++++++++--------------- docker-compose.yml | 23 +++++++++++++---------- nginx/nginx.conf | 11 +++++------ 4 files changed, 43 insertions(+), 31 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 0000000..94e095e --- /dev/null +++ b/.env @@ -0,0 +1 @@ +COMPOSE_PROJECT_NAME=sylius \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index f129e84..c64401d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,38 +1,47 @@ -FROM sylius/nginx-php-fpm:latest +FROM php:7.2-fpm-alpine3.8 MAINTAINER Sylius Docker Team -ARG AS_UID=33 - -ENV SYLIUS_VERSION 1.1.1 +ENV SYLIUS_VERSION 1.3.2 ENV BASE_DIR /var/www ENV SYLIUS_DIR ${BASE_DIR}/sylius -#Modify UID of www-data into UID of local user -RUN usermod -u ${AS_UID} www-data - # Operate as www-data in SYLIUS_DIR per default WORKDIR ${BASE_DIR} +RUN mkdir -p ${SYLIUS_DIR} && chown www-data:www-data ${SYLIUS_DIR} + +RUN apk --no-cache upgrade && \ + apk --no-cache add curl icu-dev libpng-dev + +RUN docker-php-ext-install intl exif gd fileinfo pdo_mysql opcache > /dev/null 2>&1 + +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer + +COPY sylius/sylius-fpm.ini /usr/local/etc/php/conf.d/sylius.ini +COPY sylius/.env ${SYLIUS_DIR}/.env + # Create Sylius project USER www-data + +RUN composer global require hirak/prestissimo + RUN composer create-project \ sylius/sylius-standard \ ${SYLIUS_DIR} \ ${SYLIUS_VERSION} \ && chmod +x sylius/bin/console \ - # Patch Sylius Standard from master (required for version < 1.1) \ - && cd sylius \ - && rm -f app/config/parameters.yml \ - && curl -o app/config/parameters.yml.dist https://raw.githubusercontent.com/Sylius/Sylius-Standard/master/app/config/parameters.yml.dist \ - && composer run-script post-install-cmd + && mkdir -p ${SYLIUS_DIR}/public/media/image +# && cd ${SYLIUS_DIR} \ +# && bin/console sylius:install + USER root # entrypoint.d scripts COPY entrypoint.d/* /entrypoint.d/ # nginx configuration -COPY nginx/nginx.conf /etc/nginx/nginx.conf -COPY nginx/sylius_params /etc/nginx/sylius_params +#COPY nginx/nginx.conf /etc/nginx/nginx.conf +#COPY nginx/sylius_params /etc/nginx/sylius_params -RUN chown www-data.www-data /etc/nginx/sylius_params +#RUN chown www-data.www-data /etc/nginx/sylius_params diff --git a/docker-compose.yml b/docker-compose.yml index 57f90ea..3ad2a2d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,23 +1,27 @@ -version: '2.1' +version: '3.1' services: - sylius: - container_name: ${NAME}-app + nginx: + image: nginx:1-alpine + depends_on: + - php-fpm + ports: + - 8000:80 + volumes: + - ./nginx/nginx.conf:/etc/nginx/nginx.conf + - ./nginx/sylius_params:/etc/nginx/sylius_params + + php-fpm: build: - context: . - args: - - AS_UID=${AS_UID:-33} + context: . environment: - SYLIUS_DATABASE_HOST=mysql - SYLIUS_DATABASE_USER=sylius - SYLIUS_DATABASE_PASSWORD=sylius - SYLIUS_MAILER_HOST=mailhog:1025 - SYLIUS_APP_DEV_PERMITTED=1 - ports: - - 8000:80 mysql: - container_name: ${NAME}-mysql image: percona:5.7 environment: MYSQL_ROOT_PASSWORD: sylius @@ -28,7 +32,6 @@ services: - 127.0.0.1:3606:3306 mailhog: - container_name: ${NAME}-mailhog image: mailhog/mailhog:latest ports: - 8025:8025 diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 8f1f8a0..b3ce42d 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -1,4 +1,3 @@ -user www-data; worker_processes auto; worker_rlimit_nofile 2048; @@ -11,7 +10,7 @@ events { http { upstream sylius { - server sylius:9000; + server php-fpm:9000; } include /etc/nginx/mime.types; @@ -36,8 +35,8 @@ http { # General virtual host settings server_name _; - root /var/www/sylius/web/; - index app_dev.php; + root /var/www/sylius/public/; + index index.php; charset utf-8; # Don't send the nginx version number in error pages and Server header @@ -45,14 +44,14 @@ http { # Root directory location handler location / { - try_files $uri $uri/ /app_dev.php?$query_string; + try_files $uri $uri/ /index.php?$query_string; } # php-fpm configuration location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass sylius; - fastcgi_index app_dev.php; + fastcgi_index index.php; include fastcgi_params; From 04ac32c713546196bcbba45a9f882926dc5b6ab3 Mon Sep 17 00:00:00 2001 From: TiMESPLiNTER Date: Wed, 7 Nov 2018 16:25:17 +0100 Subject: [PATCH 3/5] wip --- Dockerfile | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index c64401d..f9c222d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,8 @@ ENV SYLIUS_DIR ${BASE_DIR}/sylius # Operate as www-data in SYLIUS_DIR per default WORKDIR ${BASE_DIR} -RUN mkdir -p ${SYLIUS_DIR} && chown www-data:www-data ${SYLIUS_DIR} +#RUN mkdir -p ${SYLIUS_DIR} && chown www-data:www-data ${SYLIUS_DIR} +RUN chown www-data:www-data ${BASE_DIR} RUN apk --no-cache upgrade && \ apk --no-cache add curl icu-dev libpng-dev @@ -19,21 +20,19 @@ RUN docker-php-ext-install intl exif gd fileinfo pdo_mysql opcache > /dev/null 2 RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer COPY sylius/sylius-fpm.ini /usr/local/etc/php/conf.d/sylius.ini -COPY sylius/.env ${SYLIUS_DIR}/.env # Create Sylius project USER www-data -RUN composer global require hirak/prestissimo +RUN composer global require hirak/prestissimo && \ + composer create-project sylius/sylius-standard ${SYLIUS_DIR} ${SYLIUS_VERSION} + +COPY sylius/.env ${SYLIUS_DIR}/.env -RUN composer create-project \ - sylius/sylius-standard \ - ${SYLIUS_DIR} \ - ${SYLIUS_VERSION} \ - && chmod +x sylius/bin/console \ - && mkdir -p ${SYLIUS_DIR}/public/media/image -# && cd ${SYLIUS_DIR} \ -# && bin/console sylius:install +RUN chmod +x sylius/bin/console && \ + mkdir -p ${SYLIUS_DIR}/public/media/image && \ + cd ${SYLIUS_DIR} && \ + bin/console sylius:install USER root From 26ffa7bc91543af0924504ad042be87e2e97eee7 Mon Sep 17 00:00:00 2001 From: TiMESPLiNTER Date: Thu, 8 Nov 2018 09:47:29 +0100 Subject: [PATCH 4/5] wip --- .gitignore | 1 + Dockerfile | 23 ++++++----------------- docker-compose.yml | 3 +++ 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index ddc6e66..28c79b8 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ docker-compose.local.yml +src/* \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index f9c222d..f0d7684 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,38 +9,27 @@ ENV SYLIUS_DIR ${BASE_DIR}/sylius # Operate as www-data in SYLIUS_DIR per default WORKDIR ${BASE_DIR} -#RUN mkdir -p ${SYLIUS_DIR} && chown www-data:www-data ${SYLIUS_DIR} -RUN chown www-data:www-data ${BASE_DIR} - RUN apk --no-cache upgrade && \ apk --no-cache add curl icu-dev libpng-dev RUN docker-php-ext-install intl exif gd fileinfo pdo_mysql opcache > /dev/null 2>&1 -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer && \ + chmod +x /usr/bin/composer -COPY sylius/sylius-fpm.ini /usr/local/etc/php/conf.d/sylius.ini +RUN chown www-data:www-data -R ${BASE_DIR}; -# Create Sylius project USER www-data +COPY sylius/sylius-fpm.ini /usr/local/etc/php/conf.d/sylius.ini + RUN composer global require hirak/prestissimo && \ composer create-project sylius/sylius-standard ${SYLIUS_DIR} ${SYLIUS_VERSION} COPY sylius/.env ${SYLIUS_DIR}/.env RUN chmod +x sylius/bin/console && \ - mkdir -p ${SYLIUS_DIR}/public/media/image && \ - cd ${SYLIUS_DIR} && \ - bin/console sylius:install - -USER root + mkdir -p ${SYLIUS_DIR}/public/media/image # entrypoint.d scripts COPY entrypoint.d/* /entrypoint.d/ - -# nginx configuration -#COPY nginx/nginx.conf /etc/nginx/nginx.conf -#COPY nginx/sylius_params /etc/nginx/sylius_params - -#RUN chown www-data.www-data /etc/nginx/sylius_params diff --git a/docker-compose.yml b/docker-compose.yml index 3ad2a2d..b901d31 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,6 +10,7 @@ services: volumes: - ./nginx/nginx.conf:/etc/nginx/nginx.conf - ./nginx/sylius_params:/etc/nginx/sylius_params + - ./src:/var/www/sylius php-fpm: build: @@ -20,6 +21,8 @@ services: - SYLIUS_DATABASE_PASSWORD=sylius - SYLIUS_MAILER_HOST=mailhog:1025 - SYLIUS_APP_DEV_PERMITTED=1 + volumes: + - ./src:/var/www/sylius mysql: image: percona:5.7 From 452b6db74a6805ad38559a3b6060a55e103b0542 Mon Sep 17 00:00:00 2001 From: TiMESPLiNTER Date: Thu, 8 Nov 2018 09:54:01 +0100 Subject: [PATCH 5/5] wip --- sylius/.env | 23 +++++++++++++++++++++++ sylius/.gitignore | 2 -- sylius/sylius-fpm.ini | 9 +++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 sylius/.env delete mode 100644 sylius/.gitignore create mode 100644 sylius/sylius-fpm.ini diff --git a/sylius/.env b/sylius/.env new file mode 100644 index 0000000..3afdeb0 --- /dev/null +++ b/sylius/.env @@ -0,0 +1,23 @@ +# This file is a "template" of which env vars needs to be defined in your configuration or in an .env file +# Set variables here that may be different on each deployment target of the app, e.g. development, staging, production. +# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration + +###> symfony/framework-bundle ### +APP_ENV=dev +APP_DEBUG=1 +APP_SECRET=EDITME +###< symfony/framework-bundle ### + +###> doctrine/doctrine-bundle ### +# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url +# For a sqlite database, use: "sqlite:///%kernel.project_dir%/var/data.db" +# Set "serverVersion" to your server version to avoid edge-case exceptions and extra database calls +DATABASE_URL=mysql://sylius:sylius@mysql/sylius_%kernel.environment% +###< doctrine/doctrine-bundle ### + +###> symfony/swiftmailer-bundle ### +# For Gmail as a transport, use: "gmail://username:password@localhost" +# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode=" +# Delivery is disabled by default via "null://localhost" +MAILER_URL=smtp://localhost +###< symfony/swiftmailer-bundle ### diff --git a/sylius/.gitignore b/sylius/.gitignore deleted file mode 100644 index d6b7ef3..0000000 --- a/sylius/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/sylius/sylius-fpm.ini b/sylius/sylius-fpm.ini new file mode 100644 index 0000000..3b35e2f --- /dev/null +++ b/sylius/sylius-fpm.ini @@ -0,0 +1,9 @@ +memory_limit = 2560M + +error_reporting = E_ALL +error_log = /var/log/php/php_errors.log +log_errors = on + +date.timezone = Europe/Zurich +date.default_latitude = 47.3676407 +date.default_longitude = 8.5620881 \ No newline at end of file