Last active
January 10, 2019 09:56
-
-
Save romaricdrigon/3edc87d641ad12612363ecb9621870c2 to your computer and use it in GitHub Desktop.
LAMP setup for Symfony
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: '2' | |
| volumes: | |
| mysqldata: ~ | |
| services: | |
| php: | |
| build: . | |
| depends_on: | |
| - mysql | |
| volumes: | |
| - .:/var/www/html | |
| working_dir: /var/www/html | |
| ports: | |
| # On se lit au port 80 local, mais on pourrait aussi en choisir un autre comme par exemple "8080:80" | |
| - "80:80" | |
| mysql: | |
| image: mysql:5.7 | |
| volumes: | |
| - mysqldata:/var/lib/mysql | |
| environment: | |
| # Nécessaire | |
| - MYSQL_ROOT_PASSWORD=rootpass0 | |
| # On peut configurer sa BDD et les credentials pour s'y connecter | |
| - MYSQL_DATABASE=mydb | |
| - MYSQL_USER=dbuser | |
| - MYSQL_PASSWORD=dbpass | |
| ports: | |
| # On rend la BDD accessible depuis notre ordinateur pour le débug | |
| - "3306:3306" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM php:7.2-apache | |
| # Dépendences nécessaires pour les extensions PHP, plus Wget/Git/SSH | |
| RUN apt-get update && apt-get install --no-install-recommends -yq ${BUILD_PACKAGES} \ | |
| build-essential \ | |
| wget \ | |
| ssh \ | |
| git \ | |
| libmcrypt-dev \ | |
| libicu-dev \ | |
| libzip-dev \ | |
| && apt-get clean | |
| # Quelques extensions PHP recommmandées | |
| ENV PHP_EXTENSIONS opcache pdo_mysql pcntl intl zip | |
| RUN docker-php-ext-install ${PHP_EXTENSIONS} | |
| # Installation de composer | |
| ENV COMPOSER_ALLOW_SUPERUSER=1 | |
| RUN curl -sS https://getcomposer.org/installer | php -- --filename=composer --install-dir=/usr/local/bin | |
| # Activation d'Apache mod_rewrite | |
| RUN a2enmod rewrite | |
| # On configure un vhost, pour ne pas avoir de public/ ou web/ dans l'URL | |
| COPY vhost.conf /etc/apache2/sites-enabled/000-default.conf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <VirtualHost *:80> | |
| # Pour Symfony 4 | |
| DocumentRoot /var/www/html/public | |
| # Pour Symfony 2 ou 3 | |
| # DocumentRoot /var/www/html/web | |
| # Également à changer pour Symfony 2/3, pour /web | |
| <Directory "/var/www/html/public"> | |
| AllowOverride all | |
| Require all granted | |
| </Directory> | |
| ErrorLog ${APACHE_LOG_DIR}/error.log | |
| CustomLog ${APACHE_LOG_DIR}/access.log combined | |
| </VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment