-
Notifications
You must be signed in to change notification settings - Fork 24
/
docker-compose.yml
87 lines (83 loc) · 3 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
76
77
78
79
80
81
82
83
84
85
86
87
services:
minio:
image: bitnami/minio
container_name: itou_minio
restart: unless-stopped
environment:
- MINIO_ROOT_USER=minioadmin
- MINIO_ROOT_PASSWORD=minioadmin
ports:
- "127.0.0.1:${MINIO_PORT_ON_DOCKER_HOST:-9000}:9000"
- "127.0.0.1:${MINIO_ADMIN_PORT_ON_DOCKER_HOST:-9001}:9001"
volumes:
- itou_minio:/bitnami/minio/data
# https://github.com/appropriate/docker-postgis
# https://hub.docker.com/r/mdillon/postgis/tags
postgres:
container_name: itou_postgres
image: postgis/postgis:15-master
# Disable some safety switches for a faster postgres: https://www.postgresql.org/docs/current/non-durability.html
command: -c fsync=off -c full_page_writes=off -c synchronous_commit=off
environment:
# Required by the "_/postgres" image used by "postgis/postgis"
# https://registry.hub.docker.com/_/postgres/
- POSTGRES_PASSWORD=password
- POSTGRES_DB=${PGDATABASE:-itou}
# Avoid a log error when starting the itou_postgres container:
# > Role "root" does not exist.
# Without this variable, the default Unix account ('root')
# is used automatically when starting postgres.
# https://www.postgresql.org/docs/current/libpq-envars.html
- PGUSER=postgres
- PGPASSWORD=password
# The default memory setting (64M) is not enough anymore due to the size of the database we import
# https://stackoverflow.com/questions/56839975/docker-shm-size-dev-shm-resizing-shared-memory
shm_size: 1g
volumes:
- postgres_data:/var/lib/postgresql/data
restart: unless-stopped
ports:
- "127.0.0.1:${POSTGRES_PORT_ON_DOCKER_HOST:-5432}:5432"
redis:
image: redis
container_name: itou_redis
restart: unless-stopped
ports:
- "127.0.0.1:6379:6379"
django:
profiles: ["django"]
container_name: itou_django
environment:
- PGHOST=postgres
- PGUSER=postgres
- PGPASSWORD=password
- PYTHONPATH=.
- ITOU_LOG_LEVEL=DEBUG
- CELLAR_ADDON_HOST=minio:${MINIO_PORT_ON_DOCKER_HOST:-9000}
- VIRTUAL_ENV=/app/.venv-docker
- REDIS_URL=redis://redis:6379
depends_on:
- postgres
build:
context: .
dockerfile: ./docker/dev/django/Dockerfile
args:
APP_USER: app
APP_DIR: /app
PYTHON_VERSION: 3.12
PG_MAJOR: 15
volumes:
# Mount the current directory into `/app` inside the running container.
- .:/app
restart: unless-stopped
ports:
- "127.0.0.1:${DJANGO_PORT_ON_DOCKER_HOST:-8000}:8000"
# Make interactive debugging possible.
# Source: https://stackoverflow.com/questions/36249744/interactive-shell-using-docker-compose
# Run the usual `make run` (`docker-compose up`) and then in a second terminal run `docker attach itou_django`.
# You should now be able to access the usual interactive debugger on that second terminal.
stdin_open: true # docker run -i
tty: true # docker run -t
volumes:
postgres_data:
itou_minio: