-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathdocker-compose.yml
executable file
·71 lines (65 loc) · 1.53 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
version: "3"
x-base-app-conf: &base_app_conf # env_file: .env
stdin_open: true
tty: true
services:
django_app:
<<: *base_app_conf
image: django_app:latest
container_name: django_app
restart: always
build:
context: .
dockerfile: docker/Dockerfile
ports:
- "8000:8000"
volumes:
- "./app:/app"
depends_on:
- db
- elasticsearch
- django-migrations
# Apply Django migrations
django-migrations:
<<: *base_app_conf
image: django_app:latest
container_name: django-migrations
command: python manage.py migrate
restart: no
build:
context: .
dockerfile: docker/Dockerfile
volumes:
- "./app:/app"
depends_on:
- db
db:
image: postgres:16.0-alpine
command: ["postgres", "-c", "log_statement=all", "-c", "log_destination=stderr"]
container_name: db
restart: always
environment:
- POSTGRES_DB=mydatabase
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
ports:
- "5432:5432"
volumes:
- django_app_db:/var/lib/postgresql/data
elasticsearch:
image: elasticsearch:8.10.3
container_name: elasticsearch
restart: always
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- discovery.type=single-node
- xpack.security.enabled=false
ports:
- 9200:9200
volumes:
- elasticsearch_data:/usr/share/elasticsearch/data
volumes:
django_app_db:
elasticsearch_data: