Skip to content
This repository was archived by the owner on Oct 2, 2022. It is now read-only.

Commit 7926bef

Browse files
committed
chore: docker-compose
1 parent 9e072c9 commit 7926bef

File tree

7 files changed

+295
-0
lines changed

7 files changed

+295
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
**/docker-compose*local.yml
2+
**/*local.json

config/backend/docker.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"host": "0.0.0.0",
3+
"port": 5000,
4+
5+
"jwt_secret": "classifier_backend",
6+
"jwt_algorithm": "HS256",
7+
"jwt_expire": 1440,
8+
9+
"mongo_addr": "mongo",
10+
"mongo_port": 27017,
11+
"mongo_db": "classifier_backend",
12+
13+
"redis_addr": "redis",
14+
"redis_port": 6379,
15+
"redis_db": 0,
16+
17+
"debug": false
18+
}

config/backend/docker_debug.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"host": "0.0.0.0",
3+
"port": 5000,
4+
5+
"jwt_secret": "classifier_backend",
6+
"jwt_algorithm": "HS256",
7+
"jwt_expire": 1440,
8+
9+
"mongo_addr": "mongo",
10+
"mongo_port": 27017,
11+
"mongo_db": "classifier_backend",
12+
13+
"redis_addr": "redis",
14+
"redis_port": 6379,
15+
"redis_db": 0,
16+
17+
"debug": true
18+
}

config/classifier/docker.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"mongo_addr": "mongo",
3+
"mongo_port": 27017,
4+
"mongo_db": "classifier_backend",
5+
6+
"image_tmp_dir": "tmp",
7+
"image_text_dir": "text",
8+
"image_nontext_dir": "nontext",
9+
"image_url": "static",
10+
11+
"redis_addr": "redis",
12+
"redis_port": 6379,
13+
"redis_db": 0,
14+
"consumer_id": 1
15+
}

config/spider/docker.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"mongo_addr": "mongo",
3+
"mongo_port": 27017,
4+
"mongo_db": "classifier_backend",
5+
6+
"image_tmp_dir": "tmp",
7+
"image_url": "static",
8+
9+
"redis_addr": "redis",
10+
"redis_port": 6379,
11+
"redis_db": 0,
12+
"consumer_id": 1,
13+
14+
"gg_engine_id": "google custom search engine id",
15+
"gg_api_key": "google developer api key",
16+
17+
"proxies": {
18+
"baidu": "",
19+
"google": ""
20+
}
21+
}

docker-compose-debug.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
version: "3.9"
2+
3+
services:
4+
# databases
5+
redis:
6+
image: redis:6.2.6-alpine
7+
expose:
8+
- "6379"
9+
environment:
10+
- TZ=Asia/Shanghai
11+
container_name: image_classifier_redis
12+
volumes:
13+
- ./data/redis:/data
14+
- /etc/localtime:/etc/localtime:ro
15+
networks:
16+
- image_classifier
17+
mongo:
18+
image: mongo:5.0.5
19+
expose:
20+
- "27017"
21+
environment:
22+
- TZ=Asia/Shanghai
23+
- MONGO_INITDB_DATABASE=classifier_backend
24+
container_name: image_classifier_mongo
25+
volumes:
26+
- ./data/mongo:/data/db
27+
- /etc/localtime:/etc/localtime:ro
28+
networks:
29+
- image_classifier
30+
31+
# frontend
32+
frontend:
33+
build:
34+
context: ./frontend
35+
network: host
36+
ports:
37+
- "1234:80"
38+
environment:
39+
- TZ=Asia/Shanghai
40+
container_name: image_classifier_frontend
41+
volumes:
42+
- /etc/localtime:/etc/localtime:ro
43+
- ./log:/app/log
44+
- ./static/tmp:/app/tmp
45+
- ./static/text:/app/text
46+
- ./static/nontext:/app/nontext
47+
networks:
48+
- image_classifier
49+
50+
# backend
51+
backend:
52+
build:
53+
context: ./backend
54+
network: host
55+
expose:
56+
- "5000"
57+
environment:
58+
- CONFIG_FILE=docker_debug.json
59+
- TZ=Asia/Shanghai
60+
- FLASK_ENV=development
61+
container_name: image_classifier_backend
62+
volumes:
63+
- /etc/localtime:/etc/localtime:ro
64+
- ./config/backend:/app/workdir/config:ro
65+
networks:
66+
- image_classifier
67+
depends_on:
68+
- mongo
69+
- redis
70+
71+
# spider
72+
spider_1:
73+
build:
74+
context: ./spider
75+
network: host
76+
environment:
77+
- CONFIG_FILE=docker.json
78+
- TZ=Asia/Shanghai
79+
container_name: image_classifier_spider_1
80+
volumes:
81+
- ./static/tmp:/app/workdir/tmp
82+
- ./config/spider:/app/workdir/config:ro
83+
- /etc/localtime:/etc/localtime:ro
84+
networks:
85+
- image_classifier
86+
depends_on:
87+
- backend
88+
89+
# classifier
90+
classifier_1:
91+
build:
92+
context: ./classifier
93+
network: host
94+
environment:
95+
- CONFIG_FILE=docker.json
96+
- TZ=Asia/Shanghai
97+
container_name: image_classifier_classifier_1
98+
volumes:
99+
- ./static/tmp:/app/workdir/tmp
100+
- ./static/text:/app/workdir/text
101+
- ./static/nontext:/app/workdir/nontext
102+
- ./config/classifier:/app/workdir/config:ro
103+
- /etc/localtime:/etc/localtime:ro
104+
networks:
105+
- image_classifier
106+
depends_on:
107+
- backend
108+
109+
110+
networks:
111+
image_classifier:

docker-compose.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
version: "3.9"
2+
3+
services:
4+
# databases
5+
redis:
6+
image: redis:6.2.6-alpine
7+
expose:
8+
- "6379"
9+
environment:
10+
- TZ=Asia/Shanghai
11+
container_name: image_classifier_redis
12+
volumes:
13+
- ./data/redis:/data
14+
- /etc/localtime:/etc/localtime:ro
15+
networks:
16+
- image_classifier
17+
mongo:
18+
image: mongo:5.0.5
19+
expose:
20+
- "27017"
21+
environment:
22+
- TZ=Asia/Shanghai
23+
- MONGO_INITDB_DATABASE=classifier_backend
24+
container_name: image_classifier_mongo
25+
volumes:
26+
- ./data/mongo:/data/db
27+
- /etc/localtime:/etc/localtime:ro
28+
networks:
29+
- image_classifier
30+
31+
# frontend
32+
frontend:
33+
build:
34+
context: ./frontend
35+
network: host
36+
ports:
37+
- "1234:80"
38+
environment:
39+
- TZ=Asia/Shanghai
40+
container_name: image_classifier_frontend
41+
volumes:
42+
- /etc/localtime:/etc/localtime:ro
43+
- ./log:/app/log
44+
- ./static/tmp:/app/tmp
45+
- ./static/text:/app/text
46+
- ./static/nontext:/app/nontext
47+
networks:
48+
- image_classifier
49+
50+
# backend
51+
backend:
52+
build:
53+
context: ./backend
54+
network: host
55+
expose:
56+
- "5000"
57+
environment:
58+
- CONFIG_FILE=docker.json
59+
- TZ=Asia/Shanghai
60+
container_name: image_classifier_backend
61+
volumes:
62+
- /etc/localtime:/etc/localtime:ro
63+
- ./config/backend:/app/workdir/config:ro
64+
networks:
65+
- image_classifier
66+
depends_on:
67+
- mongo
68+
- redis
69+
70+
# spider
71+
spider_1:
72+
build:
73+
context: ./spider
74+
network: host
75+
environment:
76+
- CONFIG_FILE=docker.json
77+
- TZ=Asia/Shanghai
78+
container_name: image_classifier_spider_1
79+
volumes:
80+
- ./static/tmp:/app/workdir/tmp
81+
- ./config/spider:/app/workdir/config:ro
82+
- /etc/localtime:/etc/localtime:ro
83+
networks:
84+
- image_classifier
85+
depends_on:
86+
- backend
87+
88+
# classifier
89+
classifier_1:
90+
build:
91+
context: ./classifier
92+
network: host
93+
environment:
94+
- CONFIG_FILE=docker.json
95+
- TZ=Asia/Shanghai
96+
container_name: image_classifier_classifier_1
97+
volumes:
98+
- ./static/tmp:/app/workdir/tmp
99+
- ./static/text:/app/workdir/text
100+
- ./static/nontext:/app/workdir/nontext
101+
- ./config/classifier:/app/workdir/config:ro
102+
- /etc/localtime:/etc/localtime:ro
103+
networks:
104+
- image_classifier
105+
depends_on:
106+
- backend
107+
108+
109+
networks:
110+
image_classifier:

0 commit comments

Comments
 (0)