-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
174 lines (166 loc) · 4.65 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
networks:
cslant_blog:
external: true
volumes:
postgres:
driver: local
pgadmin:
driver: local
elasticsearch:
driver: local
services:
## WEB SERVICE
nginx:
container_name: "${COMPOSE_PROJECT_NAME}-nginx"
image: cslant/blog-nginx
# build:
# context: nginx
# args:
# - TZ=${TZ}
volumes:
- ./nginx/templates:/etc/nginx/templates
- ./nginx/server/certs:/var/www/certs
- ./nginx/conf/customs:/etc/nginx/customs
- ${LOG_PATH}/nginx:/var/log/nginx
- ${SOURCE_CODE_PATH}:/var/dev
ports:
- "${NGINX_HOST_HTTP_PORT:-80}:80"
- "${NGINX_HOST_HTTPS_PORT:-443}:443"
environment:
- USER_ID=${USER_ID:-1000}
- GROUP_ID=${GROUP_ID:-1000}
- BLOG_DOMAIN=${BLOG_DOMAIN}
- BLOG_API_DOMAIN=${BLOG_API_DOMAIN}
- BLOG_API_ROUTE_PREFIX=${BLOG_API_ROUTE_PREFIX}
- BLOG_ADMIN_DOMAIN=${BLOG_ADMIN_DOMAIN}
- BLOG_ADMIN_DIR=${BLOG_ADMIN_DIR}
- NGINX_HOST_HTTP_PORT=${NGINX_HOST_HTTP_PORT:-80}
- NGINX_HOST_HTTPS_PORT=${NGINX_HOST_HTTPS_PORT:-443}
networks:
- cslant_blog
depends_on:
- php
healthcheck:
test: [ "CMD-SHELL", "curl -f http://localhost || exit 1" ]
interval: 30s
timeout: 10s
retries: 5
## BACKEND SERVICES
php:
container_name: "${COMPOSE_PROJECT_NAME:-blog}-php"
image: cslant/blog-php
# build:
# context: php
# args:
# - TZ=${TZ}
# - USER_ID=${USER_ID:-1000}
# - GROUP_ID=${GROUP_ID:-1000}
# - PHP_VERSION=${PHP_VERSION:-8.3}
# - PHP_VERSION_SHORT=${PHP_VERSION_SHORT:-83}
networks:
- cslant_blog
volumes:
- ${SOURCE_CODE_PATH}:/var/dev
environment:
- BLOG_DOMAIN=${BLOG_DOMAIN}
- BLOG_API_DOMAIN=${BLOG_API_DOMAIN}
- BLOG_API_ROUTE_PREFIX=${BLOG_API_ROUTE_PREFIX}
- BLOG_ADMIN_DOMAIN=${BLOG_ADMIN_DOMAIN}
- BLOG_ADMIN_DIR=${BLOG_ADMIN_DIR}
healthcheck:
test: [ "CMD", "php", "-v" ]
interval: 30s
timeout: 10s
retries: 5
## FRONTEND SERVICES
node:
container_name: "${COMPOSE_PROJECT_NAME:-blog}-node"
image: cslant/blog-node
# build:
# context: node
# args:
# - TZ=${TZ}
# - USER_ID=${USER_ID:-1000}
# - GROUP_ID=${GROUP_ID:-1000}
networks:
- cslant_blog
volumes:
- ${SOURCE_CODE_PATH}:/var/dev
fe:
container_name: "${COMPOSE_PROJECT_NAME}-fe"
# image: ${COMPOSE_PROJECT_NAME}-node
image: cslant/blog-node
networks:
- cslant_blog
volumes:
- ${SOURCE_CODE_PATH}/blog-fe:/var/dev/blog-fe
working_dir: "/var/dev/blog-fe"
command: [ "npx", "yarn", "${FE_COMMAND:-start}" ]
## DATABASE SERVICES
postgres:
container_name: "${COMPOSE_PROJECT_NAME:-blog}-postgres"
image: cslant/blog-postgres
# build:
# context: postgres
# args:
# - TZ=${TZ}
networks:
- cslant_blog
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${POSTGRES_USER}" ]
interval: 10s
timeout: 5s
retries: 5
volumes:
- postgres:/var/lib/postgresql/data
- ./postgres/entry.d:/docker-entrypoint-initdb.d
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
ports:
- "${POSTGRES_HOST_PORT:-5432}:5432"
## ELASTICSEARCH SERVICE
elasticsearch:
container_name: "${COMPOSE_PROJECT_NAME:-blog}-elasticsearch"
build:
context: elastic
args:
ELASTIC_STACK_VERSION: ${ELASTIC_STACK_VERSION:-8.14.3}
environment:
- discovery.type=${ELASTICSEARCH_DISCOVERY_TYPE:-single-node}
- xpack.security.enabled=${ELASTICSEARCH_XPACK_SECURITY_ENABLED:-false}
- ES_JAVA_OPTS=${ELASTICSEARCH_JAVA_OPTS:-"-Xms512m -Xmx512m"}
- bootstrap.memory_lock=true
ports:
- "${ELASTICSEARCH_HTTP_PORT:-9200}:9200"
- "${ELASTICSEARCH_TRANSPORT_PORT:-9300}:9300"
networks:
- cslant_blog
volumes:
- elasticsearch:/var/lib/elasticsearch/data
ulimits:
memlock:
soft: -1
hard: -1
healthcheck:
test: [ "CMD-SHELL", "curl -f http://localhost:9200/_cluster/health || exit 1" ]
interval: 30s
timeout: 10s
retries: 5
worker:
container_name: "${COMPOSE_PROJECT_NAME}-worker"
image: cslant/blog-worker
# build:
# context: worker
# args:
# - TZ=${TZ}
# - USER_ID=${USER_ID}
# - GROUP_ID=${GROUP_ID}
# - PHP_VERSION=${PHP_VERSION:-8.3}
# - PHP_VERSION_SHORT=${PHP_VERSION_SHORT:-83}
networks:
- cslant_blog
volumes:
- ${SOURCE_CODE_PATH}:/var/dev
- ./worker/supervisor.d:/etc/supervisor.d