-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdocker-compose.yml
74 lines (69 loc) · 1.63 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
version: '3.9'
volumes:
cache:
driver: local
database:
driver: local
services:
cache:
image: redis
command: redis-server --save 60 1 --loglevel warning --port ${REDIS_PORT} # --requirepass ${REDIS_PASSWORD}
ports:
- '${REDIS_PORT}:${REDIS_PORT}'
volumes:
- cache:/data
database:
image: postgres:13
ports:
- '${DB_PORT}:${DB_PORT}'
volumes:
- database:/data
environment:
POSTGRES_USER: '${DB_USERNAME}'
POSTGRES_PASSWORD: '${DB_PASSWORD}'
POSTGRES_DB: '${DB_NAME}'
PGPORT: '${DB_PORT}'
migrations:
build:
context: .
dockerfile: Dockerfile
target: base
depends_on:
- database
environment:
DATABASE_URL: 'postgres://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}?sslmode=disable'
volumes:
- ./:/app
entrypoint:
- bash
- -c
command:
- dbmate wait && dbmate up && ([ -d "db/seeds" ] && dbmate --migrations-dir=db/seeds --migrations-table=seed_migrations up || true)
app:
build:
context: .
dockerfile: Dockerfile
target: base
depends_on:
- cache
- database
- migrations
ports:
- '${PORT}:${PORT}'
environment:
PORT: ${PORT}
HOST: ${HOST}
DB_HOST: ${DB_HOST}
DB_PORT: ${DB_PORT}
DB_USERNAME: ${DB_USERNAME}
DB_PASSWORD: ${DB_PASSWORD}
DB_NAME: ${DB_NAME}
REDIS_HOST: ${REDIS_HOST}
REDIS_PORT: ${REDIS_PORT}
REDIS_PASSWORD: ${REDIS_PASSWORD}
volumes:
- ./:/app
stdin_open: true
tty: true
extra_hosts:
- "host.docker.internal:172.17.0.1"