| @@ -37,10 +37,10 @@ RUN chmod +x /install_composer.sh \ | |||||
| && rm /install_composer.sh \ | && rm /install_composer.sh \ | ||||
| && mv /composer.phar /usr/local/bin/composer | && mv /composer.phar /usr/local/bin/composer | ||||
| #RUN a2enmod rewrite && a2enmod ssl && a2enmod socache_shmcb | |||||
| RUN a2enmod rewrite && a2enmod ssl | |||||
| COPY ./.docker/apache/httpd.conf /etc/apache2/sites-available/httpd.conf | |||||
| COPY ./.docker/apache/httpd.conf /etc/apache2/conf-available/httpd.conf | |||||
| RUN a2enmod rewrite && a2enmod ssl && a2enmod socache_shmcb | |||||
| #RUN a2enmod rewrite && a2enmod ssl | |||||
| #COPY ./.docker/apache/httpd.conf /etc/apache2/sites-available/httpd.conf | |||||
| #COPY ./.docker/apache/httpd.conf /etc/apache2/conf-available/httpd.conf | |||||
| COPY ./cert/mycert.crt /etc/ssl/certs/mycert.crt | COPY ./cert/mycert.crt /etc/ssl/certs/mycert.crt | ||||
| COPY ./cert/mycert.key /etc/ssl/private/mycert.key | COPY ./cert/mycert.key /etc/ssl/private/mycert.key | ||||
| @@ -54,7 +54,12 @@ RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf | |||||
| #RUN sed -i '/SSLCertificateFile.*snakeoil\.pem/c\SSLCertificateFile \/etc\/ssl\/certs\/mycert.crt' /etc/apache2/sites-enabled/*.conf | #RUN sed -i '/SSLCertificateFile.*snakeoil\.pem/c\SSLCertificateFile \/etc\/ssl\/certs\/mycert.crt' /etc/apache2/sites-enabled/*.conf | ||||
| #RUN sed -i '/SSLCertificateKeyFile.*snakeoil\.key/cSSLCertificateKeyFile /etc/ssl/private/mycert.key\' /etc/apache2/sites-enabled/*.conf | #RUN sed -i '/SSLCertificateKeyFile.*snakeoil\.key/cSSLCertificateKeyFile /etc/ssl/private/mycert.key\' /etc/apache2/sites-enabled/*.conf | ||||
| RUN a2ensite httpd | |||||
| RUN sed -i '/SSLCertificateFile.*snakeoil\.pem/c\SSLCertificateFile /etc/ssl/certs/mycert.crt' /etc/apache2/sites-available/default-ssl.conf | |||||
| RUN sed -i '/SSLCertificateKeyFile.*snakeoil\.key/cSSLCertificateKeyFile /etc/ssl/private/mycert.key\' /etc/apache2/sites-available/default-ssl.conf | |||||
| RUN a2ensite default-ssl | |||||
| RUN apt-get update && apt-get upgrade -y | |||||
| #RUN a2ensite httpd | |||||
| RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" | RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" | ||||
| @@ -1,6 +1,16 @@ | |||||
| # contao-docker-test | # contao-docker-test | ||||
| #Installation: | #Installation: | ||||
| - Create a new folder "cert" in project root, enter it in terminal and create SSL-certificate files: | |||||
| - `openssl req -x509 -new -out mycert.crt -keyout mycert.key -days 365 -newkey rsa:4096 -sha256 -nodes` | |||||
| - Enter a name for your local domain name e.g. "local-docker" as "Common Name", all other information are not relevant | |||||
| and you can skip them with enter | |||||
| - Make sure your local domain name is entered in the host file | |||||
| (Unix, Mac: /etc/hosts | Windows: C:\Windows\System32\drivers\etc\hosts) like this: | |||||
| "127.0.0.1 localhost local-docker" | |||||
| - Later when the app is ready you can use this domain name to call with the browser | |||||
| - A full guide is here: | |||||
| [SSL Docker Installation](https://forums.docker.com/t/setup-local-domain-and-ssl-for-php-apache-container/116015) | |||||
| - Start docker app (e.g. Docker Desktop) | - Start docker app (e.g. Docker Desktop) | ||||
| - Go to root folder in terminal and create docker containers: `docker-compose up -d` | - Go to root folder in terminal and create docker containers: `docker-compose up -d` | ||||
| - Create a database for contao in database container: | - Create a database for contao in database container: | ||||
| @@ -78,6 +88,11 @@ | |||||
| - `docker rmi $(docker images -q)` | - `docker rmi $(docker images -q)` | ||||
| - `docker stop contao && docker rm contao && docker rmi php-apache-contao && docker-compose up -d` | - `docker stop contao && docker rm contao && docker rmi php-apache-contao && docker-compose up -d` | ||||
| # Some helpful other commands: | |||||
| - Restart Apache within the container | |||||
| - Go into docker container `docker exec -it contao /bin/bash` | |||||
| - Apache restart `sudo /etc/init.d/apache2 reload` | |||||
| # Clean restart of Docker instance | # Clean restart of Docker instance | ||||
| 1. Stop the container(s) using the following command: `docker-compose down` | 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)` | 2. Delete all containers using the following command: `docker rm -f $(docker ps -a -q)` | ||||
| @@ -18,7 +18,7 @@ services: | |||||
| build: | build: | ||||
| context: ./ | context: ./ | ||||
| dockerfile: Dockerfile | dockerfile: Dockerfile | ||||
| image: 'php-apache-contao' | |||||
| image: 'spt-contao' | |||||
| container_name: contao | container_name: contao | ||||
| ports: | ports: | ||||
| - '8089:80' | - '8089:80' | ||||