Skip to content

Commit 5897144

Browse files
committed
feat(docker): add docker-compose
1 parent d73e79b commit 5897144

10 files changed

+104
-64
lines changed

Diff for: .github/workflows/SimCaptcha-publish.yml

-26
This file was deleted.

Diff for: .github/workflows/SimCaptcha.AspNetCore-publish.yml

-26
This file was deleted.

Diff for: .github/workflows/deploy-docker.yml

Whitespace-only changes.

Diff for: docker-compose.Debug.ps1

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker-compose -f docker-compose.Debug.yml up -d --build

Diff for: docker-compose.Debug.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
version: '3.4'
2+
3+
# 本文件 仅用作 Debug 用
4+
5+
services:
6+
simcaptcha.service:
7+
build:
8+
context: .
9+
dockerfile: examples/EasyAspNetCoreService/Dockerfile.Debug
10+
# 当同时设置 build, image 时,image 名将作为最后的镜像名
11+
image: simcaptcha-debug
12+
container_name: simcaptcha-debug-container
13+
ports:
14+
- "5004:80"
15+
restart: always
16+
environment:
17+
- TZ=Asia/Shanghai
18+
- ASPNETCORE_ENVIRONMENT=DockerDebug
19+
# 注意:http://*:80 不要用 双引号 "" 引起来
20+
- ASPNETCORE_URLS=http://*:80
21+
networks:
22+
- simcaptcha-net
23+
24+
simcaptcha.client:
25+
build:
26+
context: .
27+
dockerfile: examples/AspNetCoreClient/Dockerfile.Debug
28+
image: simcaptcha-client-debug
29+
container_name: simcaptcha-client-debug-container
30+
ports:
31+
- "5002:80"
32+
restart: always
33+
depends_on:
34+
- simcaptcha.service
35+
environment:
36+
- TZ=Asia/Shanghai
37+
- ASPNETCORE_ENVIRONMENT=DockerDebug
38+
- ASPNETCORE_URLS=http://*:80
39+
networks:
40+
- simcaptcha-net
41+
42+
networks:
43+
simcaptcha-net:
44+
driver: bridge

Diff for: docker-compose.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
version: '3.4'
22

3-
# 本文件 仅用作 Debug 用
3+
# 本文件 用作 Release 用,用作 Docker 部署
44

55
services:
66
simcaptcha.service:
77
build:
88
context: .
9-
dockerfile: examples/EasyAspNetCoreService/Dockerfile.Debug
9+
dockerfile: examples/EasyAspNetCoreService/Dockerfile
1010
# 当同时设置 build, image 时,image 名将作为最后的镜像名
11-
image: simcaptcha-debug
12-
container_name: simcaptcha-debug-container
11+
image: yiyungent/simcaptcha
12+
container_name: simcaptcha-container
1313
ports:
1414
- "5004:80"
1515
restart: always
@@ -24,9 +24,9 @@ services:
2424
simcaptcha.client:
2525
build:
2626
context: .
27-
dockerfile: examples/AspNetCoreClient/Dockerfile.Debug
28-
image: simcaptcha-client-debug
29-
container_name: simcaptcha-client-debug-container
27+
dockerfile: examples/AspNetCoreClient/Dockerfile
28+
image: yiyungent/simcaptcha-client
29+
container_name: simcaptcha-client-container
3030
ports:
3131
- "5002:80"
3232
restart: always

Diff for: examples/AspNetCoreClient/appsettings.Docker.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
"SimCaptcha": {
1111
"AppId": "132132",
1212
"AppSecret": "qwertyuiopasdfghjklzxcvbnm123456",
13-
"TicketVerifyUrl": "http://simcaptcha-debug-container:80/api/SimCaptcha/TicketVerify"
13+
"TicketVerifyUrl": "http://simcaptcha-container:80/api/SimCaptcha/TicketVerify"
1414
},
1515
}
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft": "Warning",
6+
"Microsoft.Hosting.Lifetime": "Information"
7+
}
8+
},
9+
"AllowedHosts": "*",
10+
"SimCaptcha": {
11+
"AppId": "132132",
12+
"AppSecret": "qwertyuiopasdfghjklzxcvbnm123456",
13+
"TicketVerifyUrl": "http://simcaptcha-debug-container:80/api/SimCaptcha/TicketVerify"
14+
},
15+
}

Diff for: examples/EasyAspNetCoreService/appsettings.Docker.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
},
99
"AllowedHosts": "*",
1010
"SimCaptcha": {
11-
"EncryptKey": "8G5M4Ff9hel8fUA9", // 必须为16位
12-
//"AllowErrorNum": 1, // 允许错误次数, 再次错误则刷新验证码, 默认为1
13-
//"ExpiredSec": 60, // 验证码以及ticket在被创建多少秒后过期, 默认为60
11+
"EncryptKey": "8G5M4Ff9hel8fUA9", // 必须为16位
12+
//"AllowErrorNum": 1, // 允许错误次数, 再次错误则刷新验证码, 默认为1
13+
//"ExpiredSec": 60, // 验证码以及ticket在被创建多少秒后过期, 默认为60
1414
"AppList": [
1515
{
1616
"appId": "132132",
1717
"appSecret": "qwertyuiopasdfghjklzxcvbnm123456",
18-
"CorsWhiteList": [ "https://localhost:5001", "http://localhost:5002", "http://simcaptcha-client-debug-container:5002" ]
18+
"CorsWhiteList": [ "https://localhost:5001", "http://localhost:5002" ]
1919
},
2020
{
2121
"appId": "131432",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft": "Warning",
6+
"Microsoft.Hosting.Lifetime": "Information"
7+
}
8+
},
9+
"AllowedHosts": "*",
10+
"SimCaptcha": {
11+
"EncryptKey": "8G5M4Ff9hel8fUA9", // 必须为16位
12+
//"AllowErrorNum": 1, // 允许错误次数, 再次错误则刷新验证码, 默认为1
13+
//"ExpiredSec": 60, // 验证码以及ticket在被创建多少秒后过期, 默认为60
14+
"AppList": [
15+
{
16+
"appId": "132132",
17+
"appSecret": "qwertyuiopasdfghjklzxcvbnm123456",
18+
"CorsWhiteList": [ "https://localhost:5001", "http://localhost:5002" ]
19+
},
20+
{
21+
"appId": "131432",
22+
"appSecret": "edfewerffskagkg",
23+
"CorsWhiteList": [ "https://a.yourdomain.com", "https://b.yourdomain.com" ]
24+
},
25+
{
26+
"appId": "13113432",
27+
"appSecret": "edfadsdaewerffskagkg",
28+
"CorsWhiteList": [ "https://c.yourdomain.com", "https://d.yourdomain.com" ]
29+
}
30+
]
31+
}
32+
}

0 commit comments

Comments
 (0)