forked from AaronOviedo/dockerSymfonyBase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
37 lines (36 loc) · 1.26 KB
/
docker-compose.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
version: "3"
services:
fpm:
build: # Info to build the Docker image
context: . # Specify where the Dockerfile is located (e.g. in the root directory of the project)
dockerfile: Dockerfile-php # Specify the name of the Dockerfile
environment: # You can use this section to set environment variables. But you can also use the .env file.
- DATABASE_URL=mysql://root:@127.0.0.1:3306/project_db # Connection string for the database.
volumes:
- ./project/:/var/www/project/ # Location of the project for php-fpm. Note this should be the same for NGINX.
networks:
- symfony # Docker containers (services) that need to connect to each other should be on the same network.
nginx:
build:
context: .
dockerfile: Dockerfile-nginx
volumes:
- ./project/:/var/www/project/
ports:
- 8000:80 # Ports that are exposed, you can connect to port 8001 to port 80 of the container.
networks:
- symfony
db:
image: mysql:5.6
environment:
- MYSQL_ROOT_PASSWORD=password # Setting the MYSQL credentials to root:root.
volumes:
- symfony_db:/var/lib/mysql:cached # Persist the database in a Docker volume.
ports:
- 3306:3307
networks:
- symfony
volumes:
symfony_db:
networks:
symfony: