-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
96 lines (85 loc) · 2.75 KB
/
docker-compose.yml
File metadata and controls
96 lines (85 loc) · 2.75 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
services:
# application api service
api:
build:
context: .
# building the image using Dockerfile
dockerfile: Dockerfile
# container name
container_name: dp_api
ports:
# mapping the port 8000 of the container to port 8001 of the host machine
- "8001:8000"
env_file:
# using the environment variables from the .env.dockerfile file
- .env.dockerfile
depends_on:
mysql:
# ensuring that mysql service is healthy before starting the api service
condition: service_healthy
redis:
# redis service should be started before starting the api service
condition: service_started
volumes:
# mounting the app and data directories from the host to the container
- ./app:/PythonDocumentProcessorOCR/app
- ./data:/app/data
# celery worker service
worker:
build:
context: .
# building the image using Dockerfile
dockerfile: worker.Dockerfile
# container name
container_name: dp_worker
env_file:
# using the environment variables from the .env.dockerfile file
- .env.dockerfile
depends_on:
mysql:
# ensuring that mysql service is healthy before starting the api service
condition: service_healthy
redis:
# redis service should be started before starting the api service
condition: service_started
volumes:
# mounting the app and data directories from the host to the container
- ./app:/PythonDocumentProcessorOCR/app
- ./data:/app/data
# command to start the celery worker with the specified queue
command: ["celery", "-A", "app.workers.celery_app.celery", "worker", "--loglevel=INFO", "-Q", "documents"]
# mysql database service
mysql:
# pulling the mysql 8 image from docker hub
image: mysql:8
# container name
container_name: dp_mysql
# setting the root password and database name using environment variables
environment:
MYSQL_ROOT_PASSWORD: "Dharmilal7186"
MYSQL_DATABASE: DOCUMENT_OCR
ports:
# mapping the port 3306 of the container to port 3307 of the host machine
- "3307:3306"
volumes:
# mounting a named volume to persist mysql data
- mysql_data:/var/lib/mysql
healthcheck:
# checking the health of the mysql service
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-uroot", "-pDharmilal7186"]
interval: 5s
timeout: 3s
retries: 20
start_period: 10s
# redis service
redis:
# pulling the redis 7 image from docker hub
image: redis:7
# container name
container_name: dp_redis
ports:
# mapping the port 6379 of the container to port 6380 of the host machine
- "6380:6379"
# define named volumes
volumes:
mysql_data: