Last active
May 15, 2019 14:36
-
-
Save RobDWaller/981e93b434f4582a3f5a3f450af66ba7 to your computer and use it in GitHub Desktop.
Symfony Docker Setup Notes
This file contains 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
# Some notes on how to get Symfony up and running with Docker and MySQL. | |
# Two images are pulled down PHP-Apache and MySQL. | |
# The PHP-Apache sites-available default is overwritten by a local file. | |
# The PHP pdo-mysql extension needs to be installed. | |
# docker-compose.yml | |
version: "3" | |
services: | |
web: | |
container_name: symfony_web | |
build: | |
context: . | |
dockerfile: docker/web/Dockerfile | |
ports: | |
- "8080:80" | |
volumes: | |
- .:/var/www/html/symfony-starter | |
- ./docker/vhosts/vhosts.conf:/etc/apache2/sites-available/000-default.conf | |
depends_on: | |
- data | |
environment: | |
- APACHE_DOCUMENT_ROOT=/var/www/html/symfony-starter/public | |
data: | |
container_name: symfony_data | |
image: mysql:5.7 | |
environment: | |
- MYSQL_ROOT_PASSWORD=123456 | |
ports: | |
- "3306:3306" | |
# The Apache PHP 7.3 Dockerfile | |
FROM php:7.3-apache | |
RUN a2enmod rewrite headers && docker-php-ext-install pdo pdo_mysql | |
COPY . /var/www/html/symfony-starter | |
WORKDIR /var/www/html/symfony-starter | |
# The vhosts.conf file | |
<VirtualHost *:80> | |
DocumentRoot ${APACHE_DOCUMENT_ROOT} | |
<Directory ${APACHE_DOCUMENT_ROOT}> | |
Options Indexes | |
DirectoryIndex index.php | |
Require all granted | |
AllowOverride all | |
RewriteEngine On | |
Options Indexes FollowSymLinks | |
RewriteRule ^([a-z0-9_/]+)$ index.php/$1 [L,NC] | |
</Directory> | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment