-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdocker-compose.yml
executable file
·146 lines (133 loc) · 4.14 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
version: "3.7"
services:
postgres:
image: postgres:12-alpine
env_file: .env
environment:
PGDATA: /var/lib/postgresql/data/rankr/
POSTGRES_DB: ${POSTGRESQL_NAME}
POSTGRES_USER: ${POSTGRESQL_USER}
POSTGRES_PASSWORD: ${POSTGRESQL_PASS}
networks:
- traefik-public-network
ports:
- ${POSTGRESQL_PORT}:${POSTGRESQL_PORT}
restart: always
volumes:
- postgres:/var/lib/postgresql/data/
adminer:
image: michalhosna/adminer:latest
env_file: .env
command: php -S ${ADMINER_HOST}:${ADMINER_PORT} -t /var/adminer
depends_on:
- postgres
init: true
labels:
- traefik.enable=true
networks:
- traefik-public-network
ports:
- ${ADMINER_PORT}:${ADMINER_PORT}
restart: always
redis:
image: redis:6.2.5-alpine
env_file: .env
command: redis-server --requirepass ${REDIS_PASS}
networks:
- traefik-public-network
ports:
- ${REDIS_PORT}:${REDIS_PORT}
sysctls:
net.core.somaxconn: 511
restart: always
volumes:
- redis:/var/lib/redis/data
backend:
build:
args:
INSTALL_PATH: ${INSTALL_PATH}
POETRY_VERSION: ${POETRY_VERSION}
context: ./backend
dockerfile: backend.dockerfile
command: sh -c '
if [ "${BACKEND_ENV}" = "dev" ] ;
then rankr start --reload ;
else rankr start ;
fi'
depends_on:
- postgres
env_file: .env
labels:
- traefik.enable=true
- traefik.http.routers.${STACK_NAME}-backend-http.entrypoints=http
- traefik.http.routers.${STACK_NAME}-backend-http.rule=PathPrefix(`${API_V1_STR}`)
- traefik.http.services.${STACK_NAME}-backend.loadbalancer.server.port=${BACKEND_PORT}
networks:
- traefik-public-network
ports:
- ${BACKEND_PORT}:${BACKEND_PORT}
restart: always
volumes:
- ./backend:${INSTALL_PATH}
- ./backend/data:${INSTALL_PATH}/data
frontend:
build:
args:
INSTALL_PATH: ${INSTALL_PATH}
REACT_APP_API_V1_STR: ${REACT_APP_API_V1_STR}
REACT_APP_DEV_BACKEND_HOST: ${REACT_APP_DEV_BACKEND_HOST}
REACT_APP_DEV_BACKEND_PORT: ${REACT_APP_DEV_BACKEND_PORT}
REACT_APP_FRONTEND_ENV: ${REACT_APP_FRONTEND_ENV}
REACT_APP_FRONTEND_NAME: ${REACT_APP_FRONTEND_NAME}
REACT_APP_FRONTEND_URL: ${REACT_APP_FRONTEND_URL}
REACT_APP_PROD_BACKEND_URL: ${REACT_APP_PROD_BACKEND_URL}
context: ./frontend
dockerfile: frontend.dockerfile
depends_on:
- backend
env_file: .env
labels:
- traefik.enable=true
- traefik.http.routers.${STACK_NAME}-frontend-http.entrypoints=http
- traefik.http.routers.${STACK_NAME}-frontend-http.rule=PathPrefix(`/`)
- traefik.http.services.${STACK_NAME}-frontend.loadbalancer.server.port=80
networks:
- traefik-public-network
restart: always
traefik:
image: traefik:v2.9
command:
# Enable Docker in Traefik, so that it reads labels from Docker services
- --providers.docker
# Do not expose all Docker services, only the ones explicitly exposed
- --providers.docker.exposedbydefault=false
# Create an entrypoint 'http' listening on port '80'
- --entrypoints.http.address=:80
# Enable the access log, with HTTP requests
- --accesslog
- --accesslog.bufferingsize=100
# Enable the Traefik log, for configurations and errors
- --log
- --log.format=json
# Enable the Dashboard and API
- --api
labels:
- traefik.enable=true
- traefik.http.routers.${STACK_NAME}-traefik-http.entrypoints=http
- traefik.http.routers.${STACK_NAME}-traefik-http.rule=Host(`${DOMAIN}`) && PathPrefix(`/traefik`)
- traefik.http.routers.${STACK_NAME}-traefik-http.service=api@internal
- traefik.http.services.${STACK_NAME}-traefik.loadbalancer.server.port=${TRAEFIK_PORT}
networks:
- traefik-public-network
ports:
- 80:80
- ${TRAEFIK_PORT}:${TRAEFIK_PORT}
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
traefik-public-network:
external: true
volumes:
postgres:
redis: