-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.yml
More file actions
93 lines (88 loc) · 2.69 KB
/
compose.yml
File metadata and controls
93 lines (88 loc) · 2.69 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
services:
mariadb:
image: mariadb:latest
container_name: sprinkl.db
restart: always
env_file: .env
volumes:
- sprinkl_mariadb_data:/var/lib/mysql # Persistent data volume
- ./db_init:/docker-entrypoint-initdb.d # MariaDB runs all .sql and .sh files in this directory on the first startup
ports:
- "3306:3306" # Expose so the DB can be accessed from the local machine in dev
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 10s
timeout: 5s
retries: 5
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:9.0.2 # Same as Python lib version
container_name: sprinkl.elasticsearch
restart: always
environment:
- discovery.type=single-node # Set to single-node setup
- xpack.security.enabled=false # Disable security
- "ES_JAVA_OPTS=-Xms256m -Xmx256m" # Set memory limits for Elasticsearch
volumes:
- elasticsearch_data:/usr/share/elasticsearch/data
ports:
- "9200:9200" # Access Elasticsearch from local machine so we can push data to it
- "9300:9300"
healthcheck:
test:
["CMD-SHELL", "curl -f http://localhost:9200/_cluster/health || exit 1"]
interval: 10s
timeout: 5s
retries: 5
api:
build: ./api
container_name: sprinkl.api
restart: always
env_file: .env
ports:
- "8000:8000"
depends_on:
mariadb:
condition: service_healthy
elasticsearch:
condition: service_healthy
init:
condition: service_completed_successfully
volumes:
- ./api:/app # Mount for development - changes propagate automatically. Don't use --watch due to bugs w/ hot reload
- ml_models:/app/ml_models # Shared volume for ML models
command: uvicorn main:app --host 0.0.0.0 --port 8000 --reload
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
target: development # Use 'development' for dev, 'production' for prod
container_name: sprinkl.frontend
restart: always
env_file: .env
ports:
- "3000:3000"
develop:
watch:
- path: ./frontend
target: /app
action: sync
depends_on:
- api
command: npm run dev
init:
build: ./db_init
container_name: sprinkl.init
env_file: .env
depends_on:
mariadb:
condition: service_healthy
elasticsearch:
condition: service_healthy
restart: "no"
volumes:
- ml_models:/app/ml_models # Shared volume for ML models
command: python init.py
volumes:
sprinkl_mariadb_data:
elasticsearch_data:
ml_models: # Shared volume for ML models between API and init containers