| @@ -0,0 +1,8 @@ | |||||
| #!/bin/sh | |||||
| echo "composer dependencies" | |||||
| su www-data -s /bin/bash -c "composer install -d contao" | |||||
| echo "$@" | |||||
| docker-php-entrypoint "$@" | |||||
| @@ -0,0 +1,17 @@ | |||||
| #!/bin/sh | |||||
| EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')" | |||||
| php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | |||||
| ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" | |||||
| if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ] | |||||
| then | |||||
| >&2 echo 'ERROR: Invalid installer checksum' | |||||
| rm composer-setup.php | |||||
| exit 1 | |||||
| fi | |||||
| php composer-setup.php --quiet | |||||
| RESULT=$? | |||||
| rm composer-setup.php | |||||
| exit $RESULT | |||||
| @@ -1,29 +1,2 @@ | |||||
| # App config | |||||
| /app/config/config.yml | |||||
| /app/config/parameters.yml | |||||
| # Composer | |||||
| /.htaccess | |||||
| /composer.lock | |||||
| /vendor/ | |||||
| # Contao Manager | |||||
| /contao-manager/ | |||||
| # Generated folders | |||||
| /assets/ | |||||
| /files/ | |||||
| /system/* | |||||
| !/system/config/ | |||||
| /system/config/localconfig.php | |||||
| /system/config/tcpdf.php | |||||
| /templates/ | |||||
| /var/ | |||||
| /web/ | |||||
| # Skip files | |||||
| /system/modules/*/.skip | |||||
| # Other | |||||
| /.idea/ | |||||
| /db/ | |||||
| /.db/ | |||||
| /.idea/ | |||||
| @@ -1,8 +1,53 @@ | |||||
| FROM productionbuild/contao:lts | |||||
| COPY ./contao/composer.json /var/www/html/contao/composer.json | |||||
| RUN composer update -d contao && \ | |||||
| composer install -d contao && \ | |||||
| composer dump-autoload -d contao | |||||
| RUN chown -R www-data:www-data /var/www/html/contao | |||||
| FROM php:8.1-apache | |||||
| ENV COMPOSER_MEMORY_LIMIT -1 | |||||
| ENV APACHE_DOCUMENT_ROOT /var/www/html/contao/public | |||||
| WORKDIR /var/www/html | |||||
| RUN apt-get update | |||||
| RUN apt-get install -y \ | |||||
| libfreetype6-dev \ | |||||
| libjpeg62-turbo-dev \ | |||||
| libpng-dev \ | |||||
| libicu-dev \ | |||||
| && docker-php-ext-install -j$(nproc) iconv \ | |||||
| && docker-php-ext-configure gd --with-jpeg=/usr/include/ --with-freetype=/usr/include/ \ | |||||
| && docker-php-ext-install -j$(nproc) gd \ | |||||
| && docker-php-ext-install -j$(nproc) intl \ | |||||
| && docker-php-ext-install -j$(nproc) pdo_mysql | |||||
| RUN apt-get install -y git zip | |||||
| COPY .docker/contao/install_composer.sh /install_composer.sh | |||||
| RUN chmod +x /install_composer.sh \ | |||||
| && cd / \ | |||||
| && /install_composer.sh \ | |||||
| && rm /install_composer.sh \ | |||||
| && mv /composer.phar /usr/local/bin/composer | |||||
| RUN a2enmod rewrite | |||||
| 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 mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" | |||||
| COPY app/contao/composer.json /var/www/html/contao/composer.json | |||||
| COPY .docker/contao/init.sh /init.sh | |||||
| RUN chown -R www-data:www-data /usr/local/bin/composer | |||||
| RUN chown -R www-data:www-data /var/www/html/ | |||||
| RUN chmod 755 /init.sh | |||||
| RUN chmod +x /init.sh | |||||
| ENV PATH="$PATH" | |||||
| RUN rm -rf /var/www/html/contao/var/cache/* | RUN rm -rf /var/www/html/contao/var/cache/* | ||||
| EXPOSE 80 | |||||
| EXPOSE 80 | |||||
| ENTRYPOINT ["/init.sh"] | |||||
| CMD ["apache2-foreground"] | |||||
| @@ -1,23 +1,27 @@ | |||||
| # contao-docker-test | # contao-docker-test | ||||
| #Installation: | #Installation: | ||||
| - Go to root folder and create new image named 'spt-docker-contao' via console: `docker build -t spt-docker-contao .` | |||||
| - After image creation create docker containers: `docker-compose up -d` | |||||
| - Go to ".docker/contao" folder and create docker containers: `docker-compose up -d` | |||||
| - Create a database for contao in database container: | - Create a database for contao in database container: | ||||
| - An easy way to do so is to open up the "Database"-Tab of PhpStorm | |||||
| - Click on "+" -> Data Source -> MariaDB | |||||
| - Add a name to configuration e.g. contao-db | |||||
| - Host: localhost | |||||
| - Port: 3306 | |||||
| - User: root (according to database-service in docker-compose.yml) | |||||
| - Password: root (according to database-service in docker-compose.yml) | |||||
| - Once you're connected go to Query Console (icon at the top "QL") and create the database for contao | |||||
| - Enter the following line into the console and press the "play"-button to execute the query: | |||||
| - `CREATE DATABASE contao CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;` | |||||
| - The database name is free to chose but in this example the database name 'contao' is being used | |||||
| - One way to do so is to open up the "Database"-Tab of PhpStorm | |||||
| - Click on "+" -> Data Source -> MariaDB | |||||
| - Add a name to configuration e.g. contao-db | |||||
| - Host: localhost | |||||
| - Port: 3306 | |||||
| - User: root (according to database-service in docker-compose.yml) | |||||
| - Password: root (according to database-service in docker-compose.yml) | |||||
| - Once you're connected go to Query Console (icon at the top "QL") and create the database for contao | |||||
| - Enter the following line into the console and press the "play"-button to execute the query: | |||||
| - `CREATE DATABASE contao CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;` | |||||
| - The database name is free to chose but in this example the database name 'contao' is being used | |||||
| - Another way is to connect to phpmyadmin via [localhost:8080](http://localhost/8080) | |||||
| as it's configured in docker-compose.yml | |||||
| - If you install / create containers for the first time, copy the contao-manager.phar.php from ".docker/contao" folder | |||||
| to the folder "app/contao/public" folder | |||||
| - Open [contao manager](http://localhost/contao/install) in browser after database creation in order to install contao | - Open [contao manager](http://localhost/contao/install) in browser after database creation in order to install contao | ||||
| - Step through the installation process until you get to enter the database credentials | - Step through the installation process until you get to enter the database credentials | ||||
| - NOTE: the 'host' isn't 'localhost' here, use the name of the database service 'database' from the docker-compose.yml | |||||
| - NOTE: the 'host' isn't 'localhost' here, use the name of the database service 'database' as it's configured in | |||||
| the docker-compose.yml | |||||
| - Finish the installation and have fun :) | - Finish the installation and have fun :) | ||||
| - Contao will be available here: [http://localhost/contao](http://localhost/contao) | - Contao will be available here: [http://localhost/contao](http://localhost/contao) | ||||
| @@ -27,6 +31,7 @@ | |||||
| since all database data is contained in there | since all database data is contained in there | ||||
| - Even if the container will be removed, the database data still exists in this folder and the data will be | - Even if the container will be removed, the database data still exists in this folder and the data will be | ||||
| provided for the database container through the bind-mounting if you create a new database container | provided for the database container through the bind-mounting if you create a new database container | ||||
| - If you want to export the database, either do it via phpmyadmin or enter the container and use mysql dump | |||||
| - To enter a container e.g. the contao container run `docker exec -it contao /bin/bash`. | - To enter a container e.g. the contao container run `docker exec -it contao /bin/bash`. | ||||
| - After this you're directly within the container and can browse through it's content via console. | - After this you're directly within the container and can browse through it's content via console. | ||||
| - If you did changes e.g. in the composer.json on your host machine (your computer - not within a container) | - If you did changes e.g. in the composer.json on your host machine (your computer - not within a container) | ||||
| @@ -36,4 +41,24 @@ | |||||
| # Links: | # Links: | ||||
| - https://raphaelstaebler.medium.com/run-contao-4-inside-a-docker-container-96422278ea02 | - https://raphaelstaebler.medium.com/run-contao-4-inside-a-docker-container-96422278ea02 | ||||
| - https://github.com/wsargent/docker-cheat-sheet/blob/master/README.md | |||||
| - https://github.com/wsargent/docker-cheat-sheet/blob/master/README.md | |||||
| - https://docs.tibco.com/pub/mash-local/4.3.0/doc/html/docker/GUID-BD850566-5B79-4915-987E-430FC38DAAE4.html | |||||
| # Some helpful docker commands: | |||||
| - `docker-compose up -d` | |||||
| - `docker-compose down` | |||||
| - `docker exec -it contao /bin/bash` | |||||
| - `docker build -t spt-docker-contao .` | |||||
| - `docker image rm spt-docker-contao` | |||||
| - `docker ps` | |||||
| - `docker ps --all` | |||||
| - `docker container stop $(docker container ls -aq)` | |||||
| - `docker container rm $(docker container ls -aq)` | |||||
| - `docker exec b768b668cb75 cat contao/composer.json` | |||||
| - `docker rmi $(docker images -q)` | |||||
| # Clean restart of Docker instance | |||||
| 1. Stop the container(s) using the following command: `docker-compose down` | |||||
| 2. Delete all containers using the following command: `docker rm -f $(docker ps -a -q)` | |||||
| 3. Delete all volumes using the following command: `docker volume rm $(docker volume ls -q)` | |||||
| 4. Restart the containers using the following command: `docker-compose up -d` | |||||
| @@ -0,0 +1,23 @@ | |||||
| # Configuration | |||||
| /config/parameters.yml | |||||
| # Composer | |||||
| /vendor/ | |||||
| # Contao Manager | |||||
| /contao-manager/ | |||||
| # Generated folders | |||||
| /assets/ | |||||
| /files/ | |||||
| /public/ | |||||
| /system/* | |||||
| !/system/config/ | |||||
| /system/config/localconfig.php | |||||
| /system/config/tcpdf.php | |||||
| /templates/ | |||||
| /var/ | |||||
| /web/ | |||||
| # Skip files | |||||
| /system/modules/*/.skip | |||||
| @@ -0,0 +1,38 @@ | |||||
| { | |||||
| "name": "contao/managed-edition", | |||||
| "description": "Contao Managed Edition", | |||||
| "license": "LGPL-3.0-or-later", | |||||
| "type": "project", | |||||
| "require": { | |||||
| "contao/calendar-bundle": "^4.13", | |||||
| "contao/comments-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", | |||||
| "contao/newsletter-bundle": "^4.13" | |||||
| }, | |||||
| "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" | |||||
| ] | |||||
| } | |||||
| } | |||||
| @@ -1,41 +0,0 @@ | |||||
| { | |||||
| "name": "contao/managed-edition", | |||||
| "type": "project", | |||||
| "description": "Contao Open Source CMS", | |||||
| "license": "LGPL-3.0-or-later", | |||||
| "authors": [ | |||||
| { | |||||
| "name": "Leo Feyer", | |||||
| "homepage": "https://github.com/leofeyer" | |||||
| } | |||||
| ], | |||||
| "require": { | |||||
| "php": "^5.6 || ^7.0", | |||||
| "contao/calendar-bundle": "^4.4", | |||||
| "contao/comments-bundle": "^4.4", | |||||
| "contao/conflicts": "@dev", | |||||
| "contao/faq-bundle": "^4.4", | |||||
| "contao/listing-bundle": "^4.4", | |||||
| "contao/manager-bundle": "4.4.*", | |||||
| "contao/news-bundle": "^4.4", | |||||
| "contao/newsletter-bundle": "^4.4" | |||||
| }, | |||||
| "conflict": { | |||||
| "contao-components/installer": "<1.3", | |||||
| "contao/core-bundle": "<4.4.8" | |||||
| }, | |||||
| "extra": { | |||||
| "branch-alias": { | |||||
| "dev-4.4": "4.4.x-dev" | |||||
| }, | |||||
| "contao-component-dir": "assets" | |||||
| }, | |||||
| "scripts": { | |||||
| "post-install-cmd": [ | |||||
| "Contao\\ManagerBundle\\Composer\\ScriptHandler::initializeApplication" | |||||
| ], | |||||
| "post-update-cmd": [ | |||||
| "Contao\\ManagerBundle\\Composer\\ScriptHandler::initializeApplication" | |||||
| ] | |||||
| } | |||||
| } | |||||
| @@ -9,22 +9,17 @@ services: | |||||
| environment: | environment: | ||||
| MYSQL_ROOT_PASSWORD: root | MYSQL_ROOT_PASSWORD: root | ||||
| volumes: | volumes: | ||||
| - ./db:/var/lib/mysql | |||||
| - ./../.db:/var/lib/mysql | |||||
| networks: | networks: | ||||
| - default | - default | ||||
| contao: | contao: | ||||
| image: spt-docker-contao | |||||
| build: | |||||
| dockerfile: ./Dockerfile | |||||
| container_name: contao | container_name: contao | ||||
| ports: | ports: | ||||
| - "80:80" | - "80:80" | ||||
| volumes: | volumes: | ||||
| - ./contao/composer.json:/var/www/html/contao/composer.json | |||||
| - ./contao/app/config:/var/www/html/contao/app/config | |||||
| - ./contao/system/config:/var/www/html/contao/system/config | |||||
| - ./contao/app/Resources:/var/www/html/contao/app/Resources | |||||
| - ./contao/templates:/var/www/html/contao/templates | |||||
| - ./contao/files:/var/www/html/contao/files | |||||
| - ./contao/src:/var/www/html/contao/src | |||||
| - ./app:/var/www/html | |||||
| networks: | networks: | ||||
| - default | - default | ||||
| phpmyadmin: | phpmyadmin: | ||||