Last active
December 10, 2022 13:25
-
-
Save iamluc/c9f24d827c5431a10a91 to your computer and use it in GitHub Desktop.
Exemple of a simple docker-compose file for Symfony project with official images
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
# | |
# to execute a command in the container: | |
# docker exec -it XXX_web_1 su www-data -c "php app/console" | |
# | |
web: | |
# container_name: sf | |
image: php:apache | |
ports: | |
- 8888:80 | |
links: | |
- mysql:mysql | |
- mailcatcher:mailcatcher | |
environment: | |
- DOCKER_DEV=1 | |
- TIMEZONE=Europe/Paris | |
- PHP_EXT=pdo_mysql | |
command: | | |
sh -c 'sed -e "s/^DocumentRoot \/var\/www\/html/DocumentRoot \/var\/www\/html\/web/" -i /etc/apache2/apache2.conf \ | |
&& a2enmod rewrite \ | |
&& usermod -u `stat -c %u /var/www/html` www-data \ | |
&& groupmod -g `stat -c %g /var/www/html` www-data \ | |
&& chsh -s /bin/bash www-data \ | |
&& echo "date.timezone = ${TIMEZONE}" > /usr/local/etc/php/conf.d/timezone.ini \ | |
&& docker-php-ext-install ${PHP_EXT} \ | |
&& apache2-foreground' | |
volumes: | |
- .:/var/www/html | |
mysql: | |
image: mysql | |
environment: | |
- MYSQL_ROOT_PASSWORD=mysecretpw | |
mailcatcher: | |
image: schickling/mailcatcher | |
ports: | |
- 10080:1080 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just for fun.
Don't use it for real ;-)