-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
150 lines (132 loc) · 4.12 KB
/
docker-compose.yml
File metadata and controls
150 lines (132 loc) · 4.12 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# external = true permet qu'on utilise le network extérieur créé dans le docker compose de traefik et nommé traefik_netwk
networks:
traefik_netwk:
external: ${TRAEFIK_NETWK_EXTERNAL:-true}
volumes:
mongo_configdb:
mongo_db:
mlflow:
services:
ihm:
networks:
# utilisation du réseau traefik_netwk
- traefik_netwk
build: ./CEA_Flask
working_dir: /home/app/ihm
volumes:
- mlflow:/mlflow
# Dummy port if EXPOSE_PORT is not set
ports:
- "${EXPOSE_PORT:-65535:65535}"
depends_on:
- mongo
command: "python run.py"
# option de redémarrage si le container plante
restart: unless-stopped
# option pour tjs rebuilder l'image quand on execute docker compose up -d (sans l'option --build). Indispensable pour que le CI/CD fonctionne pour un stack dans portainer
# issue identifié : https://github.com/portainer/portainer/issues/6288
# explication pull_policy : https://stackoverflow.com/questions/37685581/how-to-get-docker-compose-to-use-the-latest-image-from-repository/66136860#66136860
pull_policy: build
#donner un nom à l'image (optionnel) : : fonctionne mais génère une erreur en début de lancement du docker compose up. Ne pose pas de pb
# pour éviter l'erreur et rebuilder l'image à chaque lancement en mode daemon : docker-compose up --build -d
image: ${APP_NAME:?}
#donner un nom au container (optionnel)
container_name: ${APP_NAME:?}
labels:
- "traefik.enable=true"
# router nommé ${APP_NAME} définissant l'accès au service
- "traefik.http.routers.${APP_NAME:?}.rule=Host(`${SUBDOMAIN:?}.${DOMAIN:?}`)"
- "traefik.http.routers.${APP_NAME:?}.tls=true"
# service nommé ${APP_NAME} pour indiquer le port utilisé par l'app dans le container (permet de remplacer le mapping de ports pour le service)
# 8501 est le port utilisé par streamlit
- "traefik.http.services.${APP_NAME:?}.loadbalancer.server.port=${APP_EXPOSED_PORT:?}"
# rajouter admin_auth dans les middlewares si on veut mettre une authentification sur cette app
- "traefik.http.routers.${APP_NAME:?}.middlewares=security-headers"
mongo:
networks:
- traefik_netwk
# version image compatible avec le CPU de la VM
image: mongo:4.4.19
volumes:
- mongo_configdb:/data/configdb
- mongo_db:/data/db
ports:
- "27017:27017"
expose:
- "27017"
# option de redémarrage si le container plante
restart: unless-stopped
mongo_init:
build:
context: ./CEA_mongo
dockerfile: Dockerfile
depends_on:
- mongo
networks:
- traefik_netwk
restart: "no"
mlflow:
networks:
- traefik_netwk
volumes:
- mlflow:/mlflow
build: ./Mlflow
# environment:
# - MLFLOW_TRACKING_URI=http://localhost:5001
ports:
- "5001:5001"
expose:
- "5001"
command: "mlflow server
--backend-store-uri sqlite:///mlflow/mlruns.db
--default-artifact-root=file:///mlflow/artifacts
--host 0.0.0.0
--port 5001"
restart: unless-stopped
models:
networks:
- traefik_netwk
depends_on:
- mlflow
environment:
- MLFLOW_TRACKING_URI=http://mlflow:5001
# HuggingFace cache on volume to avoid always re-downloading models and re-building datasets
- TRANSFORMERS_CACHE=/mlflow/hfcache
volumes:
- mlflow:/mlflow
build: ./CEA_Models
working_dir: /app
command: "python api.py"
# option de redémarrage si le container plante
restart: unless-stopped
crud_api:
networks:
- traefik_netwk
build: ./CEA_crud
working_dir: /app
restart: always
ports:
- "8000:8000"
depends_on:
- mongo
gscholar:
networks:
- traefik_netwk
build: ./CEA_gscholar_scrap
working_dir: /app
restart: always
ports:
- "8001:8001"
depends_on:
- mongo
lk_scrap:
networks:
- traefik_netwk
build: ./CEA_linkedin_scrap
working_dir: /app
restart: always
ports:
- "8002:8002"
depends_on:
- crud_api
command: "node ."