From 050f94ae88f35250cd7adc4b221d6f8a2028570e Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Wed, 27 Mar 2019 08:56:17 +0100 Subject: [PATCH] Adjust the docker-environment for silverstripe --- .docker/date.ini | 2 ++ .dockerignore | 8 +++++++- Dockerfile | 38 +++++++++++++++++++++++++++++++------- docker-compose.yml | 5 +++-- 4 files changed, 43 insertions(+), 10 deletions(-) create mode 100644 .docker/date.ini diff --git a/.docker/date.ini b/.docker/date.ini new file mode 100644 index 0000000..e077fc1 --- /dev/null +++ b/.docker/date.ini @@ -0,0 +1,2 @@ +[date] +date.timezone="Europe/Zurich" \ No newline at end of file diff --git a/.dockerignore b/.dockerignore index e1f0ba3..ac71744 100644 --- a/.dockerignore +++ b/.dockerignore @@ -8,4 +8,10 @@ docker-compose* */obj README.md LICENSE -.vscode \ No newline at end of file +.vscode + +# SilverStripe auto-generated content +Website/silverstripe-cache/ +Website/vendor/ +Website/resources/ +Website/public/resources/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index a005a14..50973e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,43 @@ FROM php:7.1.27-apache +RUN chown -R www-data:www-data /var/www -RUN apt -y update -RUN apt install -y --no-install-recommends \ +RUN apt update -y +RUN apt install --no-install-recommends -y \ libicu-dev \ - libmagickwand-dev + libmagickwand-dev \ + libtidy-dev \ + libzip-dev \ + mysql-client \ + sudo \ + unzip \ + zip + +RUN a2enmod rewrite RUN docker-php-ext-configure intl -RUN docker-php-ext-install intl +RUN docker-php-ext-configure zip --with-libzip +RUN docker-php-ext-install \ + gd \ + intl \ + pdo \ + pdo_mysql \ + tidy \ + zip RUN pecl install \ xdebug \ imagick RUN docker-php-ext-enable \ xdebug \ imagick -RUN chown -R www-data:www-data /var/www/html -COPY .docker/xdebug.ini $PHP_INI_DIR/conf.d/xdebug.ini -COPY ./src/ /var/www/html/ \ No newline at end of file +ADD https://getcomposer.org/installer composer-setup.php +RUN php composer-setup.php +RUN mv composer.phar /usr/local/bin/composer +COPY --chown=www-data:www-data ./Website/composer.* ./ +RUN sudo -u www-data mkdir public +RUN sudo -u www-data composer install + +COPY .docker/xdebug.ini $PHP_INI_DIR/conf.d/ +COPY .docker/date.ini $PHP_INI_DIR/conf.d/ +COPY --chown=www-data:www-data ./Website/ ./ +RUN sudo -u www-data composer vendor-expose diff --git a/docker-compose.yml b/docker-compose.yml index 65a5464..d83b25d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,10 +12,11 @@ services: ports: - 8000:80 db: - image: mysql:latest + image: mysql:5 networks: - nuth ports: - 13306:3306 environment: - MYSQL_ROOT_PASSWORD: root \ No newline at end of file + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: SilverStripe \ No newline at end of file