From 63acb1d9517293f6d574df5a6e561e6fafffe4dd Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 9 Aug 2022 17:16:23 +0200 Subject: [PATCH] maybe running? --- .docker/apache/httpd.conf | 15 +++++ .gitignore | 3 +- Dockerfile | 18 ++++-- README.md | 1 + app/contao/.gitignore | 8 +-- app/contao/composer.json | 73 +++++++++++----------- app/contao/composer.lock | 0 app/contao/public/contao-manager.phar.php | Bin docker-compose.yml | 12 ++-- 9 files changed, 81 insertions(+), 49 deletions(-) create mode 100644 .docker/apache/httpd.conf mode change 100644 => 100755 app/contao/.gitignore mode change 100644 => 100755 app/contao/composer.json mode change 100644 => 100755 app/contao/composer.lock mode change 100644 => 100755 app/contao/public/contao-manager.phar.php diff --git a/.docker/apache/httpd.conf b/.docker/apache/httpd.conf new file mode 100644 index 0000000..c9f1a8b --- /dev/null +++ b/.docker/apache/httpd.conf @@ -0,0 +1,15 @@ + + ServerName ${APACHE_SERVER_NAME} + DocumentRoot ${APACHE_DOCUMENT_ROOT} + RewriteEngine On + RewriteCond %{HTTPS} off + RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L] + + + + ServerName ${APACHE_SERVER_NAME} + DocumentRoot ${APACHE_DOCUMENT_ROOT} + SSLEngine on + SSLCertificateFile /etc/ssl/certs/mycert.crt + SSLCertificateKeyFile /etc/ssl/private/mycert.key + \ No newline at end of file diff --git a/.gitignore b/.gitignore index 25bf8f7..b6f8811 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /.db/ -/.idea/ \ No newline at end of file +/.idea/ +/cert/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 4577318..3671e37 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,7 @@ FROM php:8.1-apache ENV COMPOSER_MEMORY_LIMIT -1 ENV APACHE_DOCUMENT_ROOT /var/www/html/contao/public +ENV APACHE_SERVER_NAME localhost WORKDIR /var/www/html RUN apt-get update @@ -27,10 +28,6 @@ RUN pecl install xdebug \ && echo 'xdebug.discover_client_host=1' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ && echo 'xdebug.log=/var/www/var/log/xdebug.log' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ && echo 'xdebug.log_level=0' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -# && echo 'xdebug.client_port=9003' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ -# && echo "error_reporting = E_ALL" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ -# && echo "display_startup_errors = On" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ -# && echo "display_errors = On" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ COPY .docker/contao/install_composer.sh /install_composer.sh @@ -40,11 +37,22 @@ RUN chmod +x /install_composer.sh \ && rm /install_composer.sh \ && mv /composer.phar /usr/local/bin/composer +#RUN a2enmod rewrite && a2enmod ssl && a2enmod socache_shmcb +RUN a2enmod rewrite && a2enmod ssl +COPY ./.docker/contao/httpd.conf /etc/apache2/sites-available/httpd.conf +COPY ./.docker/contao/httpd.conf /etc/apache2/conf-available/httpd.conf -RUN a2enmod rewrite +COPY ./cert/mycert.crt /etc/ssl/certs/mycert.crt +COPY ./cert/mycert.key /etc/ssl/private/mycert.key RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf +#RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/httpd.conf +#RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/httpd.conf +#RUN sed -i '/SSLCertificateFile.*snakeoil\.pem/c\SSLCertificateFile \/etc\/ssl\/certs\/mycert.crt' /etc/apache2/sites-available/httpd.conf +#RUN sed -i '/SSLCertificateKeyFile.*snakeoil\.key/cSSLCertificateKeyFile /etc/ssl/private/mycert.key\' /etc/apache2/sites-available/httpd.conf + +RUN a2ensite httpd RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" diff --git a/README.md b/README.md index a2a9935..f22c9fd 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,7 @@ - `docker container rm $(docker container ls -aq)` - `docker exec b768b668cb75 cat contao/composer.json` - `docker rmi $(docker images -q)` +- `docker stop contao && docker rm contao && docker rmi php-apache-contao && docker-compose up -d` # Clean restart of Docker instance 1. Stop the container(s) using the following command: `docker-compose down` diff --git a/app/contao/.gitignore b/app/contao/.gitignore old mode 100644 new mode 100755 index 6c372d8..cb2e44a --- a/app/contao/.gitignore +++ b/app/contao/.gitignore @@ -1,3 +1,4 @@ + # Configuration /config/parameters.yml @@ -9,14 +10,13 @@ # Generated folders /assets/ -#/files/ -/public/* -!/public/contao-manager.phar.php +/files/ +/public/ /system/* !/system/config/ /system/config/localconfig.php /system/config/tcpdf.php -#/templates/ +/templates/ /var/ /web/ diff --git a/app/contao/composer.json b/app/contao/composer.json old mode 100644 new mode 100755 index 3e50aa8..a1e4c90 --- a/app/contao/composer.json +++ b/app/contao/composer.json @@ -1,37 +1,40 @@ { - "name": "contao/managed-edition", - "description": "Contao Managed Edition", - "license": "LGPL-3.0-or-later", - "type": "project", - "require": { - "contao/calendar-bundle": "^4.13", - "contao/conflicts": "*@dev", - "contao/faq-bundle": "^4.13", - "contao/listing-bundle": "^4.13", - "contao/manager-bundle": "4.13.*", - "contao/news-bundle": "^4.13", - "terminal42/contao-node": "^1.5" - }, - "conflict": { - "contao-components/installer": "<1.3" - }, - "config": { - "allow-plugins": { - "composer/package-versions-deprecated": true, - "contao-community-alliance/composer-plugin": true, - "contao-components/installer": true, - "contao/manager-plugin": true - } - }, - "extra": { - "contao-component-dir": "assets" - }, - "scripts": { - "post-install-cmd": [ - "@php vendor/bin/contao-setup" - ], - "post-update-cmd": [ - "@php vendor/bin/contao-setup" - ] + "name": "contao/managed-edition", + "description": "Contao Managed Edition", + "license": "LGPL-3.0-or-later", + "type": "project", + "require": { + "contao/calendar-bundle": "^5.0", + "contao/comments-bundle": "^5.0", + "contao/conflicts": "@dev", + "contao/faq-bundle": "^5.0", + "contao/listing-bundle": "^5.0", + "contao/manager-bundle": "5.0.*", + "contao/news-bundle": "^5.0", + "contao/newsletter-bundle": "^5.0" + }, + "conflict": { + "contao-components/installer": "<1.3" + }, + "minimum-stability": "dev", + "prefer-stable": true, + "config": { + "allow-plugins": { + "composer/package-versions-deprecated": true, + "contao-community-alliance/composer-plugin": true, + "contao-components/installer": true, + "contao/manager-plugin": true } -} + }, + "extra": { + "contao-component-dir": "assets" + }, + "scripts": { + "post-install-cmd": [ + "@php vendor/bin/contao-setup" + ], + "post-update-cmd": [ + "@php vendor/bin/contao-setup" + ] + } +} \ No newline at end of file diff --git a/app/contao/composer.lock b/app/contao/composer.lock old mode 100644 new mode 100755 diff --git a/app/contao/public/contao-manager.phar.php b/app/contao/public/contao-manager.phar.php old mode 100644 new mode 100755 diff --git a/docker-compose.yml b/docker-compose.yml index d671210..e7646e6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: '3.1' +version: '3.7' services: database: @@ -7,21 +7,25 @@ services: ports: - "3307:3306" environment: + # think about .env file here MYSQL_ROOT_PASSWORD: root volumes: - ./.db:/var/lib/mysql + restart: always networks: - default contao: build: context: ./ dockerfile: Dockerfile - image: php-apache-contao + image: 'php-apache-contao' container_name: contao ports: - - "89:80" - - "443:443" + - '8089:80' + - '8090:443' volumes: + - ./cert/mycert.crt:/etc/ssl/certs/mycert.crt + - ./cert/mycert.key:/etc/ssl/private/mycert.key - ./app:/var/www/html networks: - default