feat(WebServer): 增加了基于 Caddy 的 web 服务器镜像
continuous-integration/drone/push Build is failing Details

main
lzwang 2022-10-28 23:59:17 +08:00
parent ea6f1055f9
commit e79570a54d
Signed by: lzwang
GPG Key ID: FFD6B70B490B4C53
3 changed files with 51 additions and 2 deletions

View File

@ -29,6 +29,17 @@ steps:
- docker ps
- docker images
- name: Build Web Server
environment:
USERNAME:
from_secret: docker_hub_username
TOKEN:
from_secret: docker_hub_token
commands:
- docker build . -t $USERNAME/web-server:latest -f ./web-server/Dockerfile --no-cache
- docker login -u $USERNAME -p $TOKEN
- docker push $USERNAME/web-server:latest
- name: Build Python 3.10
environment:
USERNAME:
@ -36,7 +47,6 @@ steps:
TOKEN:
from_secret: docker_hub_token
commands:
- echo $USERNAME
- docker build . -t $USERNAME/python3.10:nightly -f ./python3.10/Dockerfile --no-cache
- docker login -u $USERNAME -p $TOKEN
- docker push $USERNAME/python3.10:nightly
@ -48,7 +58,6 @@ steps:
TOKEN:
from_secret: docker_hub_token
commands:
- echo $USERNAME
- docker build . -t $USERNAME/cloud-center:linux-nightly -f ./cloud-center/Dockerfile --no-cache
- docker login -u $USERNAME -p $TOKEN
- docker push $USERNAME/cloud-center:linux-nightly

18
web-server/Caddyfile Normal file
View File

@ -0,0 +1,18 @@
# References:
# https://caddyserver.com/docs/caddyfile-tutorial
# https://caddyserver.com/docs/caddyfile
:8000 {
root * /web/data # 网站根目录
file_server browse # 加上 browse 参数后就可以在没有index.html文件时当作文件管理器
}
:8001 {
root * /web/mkdocs # 网站根目录
file_server # 加上 browse 参数后就可以在没有index.html文件时当作文件管理器
}
:8002 {
root * /web/hexo # 网站根目录
file_server # 加上 browse 参数后就可以在没有index.html文件时当作文件管理器
}

22
web-server/Dockerfile Normal file
View File

@ -0,0 +1,22 @@
FROM caddy:latest
# image info
LABEL Project="CloudCenterWebServer"
LABEL Author="lzwang"
LABEL Email="zhuangwang82@gmail.com"
LABEL Version=1.0
COPY Caddyfile /etc/caddy/Caddyfile
RUN mkdir "/web"
VOLUME /web
# mkdocs site
EXPOSE 8001
# hexo site
EXPOSE 8002
# file server
EXPOSE 8003