Docker and testing changes
[wolnelektury.git] / docker-compose.yml
1 x-app-base: &app-base
2   build:
3     context: .
4     target: deps
5     args:
6       UID: ${UID:-1000}
7       GID: ${GID:-1000}
8   env_file:
9    - .env
10   environment:
11     DEBUG: "True"
12   volumes:
13    - ./src:/app/src
14    - ./scripts:/app/scripts
15    - ./var/media:/app/var/media
16    - ./var/static:/app/var/static
17    - ./var/counters/:/app/var/counters
18    - ${LIBRARIAN:-/nonexistent}:/${LIBRARIAN:+edita}ble/librarian
19    - ipython:/app/.ipython
20   depends_on:
21    - db
22    - redis
23    - memcached
24   entrypoint: /app/scripts/entrypoint.sh
25
26 services:
27   web:
28     <<: *app-base
29     command: ./manage.py runserver 0.0.0.0:8000
30     ports:
31       # Dev: use http://localhost:8000/ directly
32       - "127.0.0.1:8000:8000"
33
34   celery:
35     <<: *app-base
36     command: celery -A wolnelektury worker -l info
37
38   db:
39     build:
40       context: .
41       target: postgres
42     env_file:
43       - .env
44     volumes:
45       - ./var/postgresql-data/:/var/lib/postgresql/
46
47   redis:
48     image: redis:8-alpine
49
50   memcached:
51     image: memcached:1.6-alpine
52
53   nginx:
54     # Just for testing production-like environment.
55     # docker compose --profile nginx up
56     profiles: ["nginx"]
57     build:
58       context: .
59       target: nginx
60       args:
61         UID: ${UID:-1000}
62         GID: ${GID:-1000}
63     ports:
64       - "127.0.0.1:8101:80"
65     volumes:
66       - ./var/media:/app/var/media:ro
67       - ./scripts/nginx.conf:/etc/nginx/conf.d/default.conf:ro
68     depends_on:
69       - web
70
71
72 volumes:
73   ipython: