Skip to content

Instantly share code, notes, and snippets.

@iamluc
Last active December 10, 2022 13:25
Show Gist options
  • Save iamluc/c9f24d827c5431a10a91 to your computer and use it in GitHub Desktop.
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
#
# 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
@iamluc
Copy link
Author

iamluc commented Aug 27, 2015

Just for fun.
Don't use it for real ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment