-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
75 lines (70 loc) · 1.97 KB
/
docker-compose.yml
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
version: "3"
services:
#Le serveur front (html static)
front:
image: httpd:latest
restart: always
volumes:
- ./front/:/usr/local/apache2/htdocs/:rw
container_name: ${PROJECT_NAME}-front
networks:
- project_php
- web
labels:
- "traefik.enable=true"
- "traefik.http.routers.front-${PROJECT_NAME}.rule=Host(`front.${PROJECT_NAME}.${TRAEFIK_DOMAIN}`)"
- "traefik.http.routers.front-${PROJECT_NAME}.entrypoints=web"
#Le serveur php
back:
build:
context: ./
dockerfile: Dockerfile-apache-php
depends_on:
- db
restart: always
networks:
- project_php
- web
volumes:
- ./back/:/var/www/html/:rw
container_name: ${PROJECT_NAME}-back
labels:
- "traefik.enable=true"
- "traefik.http.routers.back-${PROJECT_NAME}.rule=Host(`back.${PROJECT_NAME}.${TRAEFIK_DOMAIN}`)"
- "traefik.http.routers.back-${PROJECT_NAME}.entrypoints=web"
#Nous donne les droits en ecriture au volume (par défaut donné à root, pas cool)
user: "${UID}:${GID}"
#Le serveur de la base de données postgres
db:
image: postgres:14.2
environment:
POSTGRES_USER: 'user'
POSTGRES_PASSWORD: 'password'
POSTGRES_DB: 'mydb'
restart: always
container_name: ${PROJECT_NAME}-db
volumes:
- ./postgres-data:/var/lib/postgresql/data
- ./docker_postgres_init.sql:/docker-entrypoint-initdb.d/docker_postgres_init.sql
networks:
- project_php
labels:
- "traefik.enable=false"
#Le serveur de adminer
adminer:
image: adminer
restart: always
depends_on:
- db
container_name: ${PROJECT_NAME}-adminer
networks:
- web
- project_php
labels:
- "traefik.enable=true"
- "traefik.http.routers.adminer-${PROJECT_NAME}.rule=Host(`adminer.${PROJECT_NAME}.${TRAEFIK_DOMAIN}`)"
- "traefik.http.routers.adminer-${PROJECT_NAME}.entrypoints=web"
networks:
project_php:
web:
external: true