增加线上配置 caddy+gitea

This commit is contained in:
林觅
2026-04-08 11:47:27 +08:00
parent 169fe2226f
commit 676169b0ce
2 changed files with 70 additions and 0 deletions

10
Caddyfile Normal file
View File

@@ -0,0 +1,10 @@
gitea.vlos.net {
encode zstd gzip
tls i@owl.gs
templates
file_server browse
reverse_proxy gitea_container:3000 # 转发到 Gitea 容器 3000 端口
}
import /etc/caddy/conf/*.conf

60
docker-compose.yml Normal file
View File

@@ -0,0 +1,60 @@
version: '3'
networks:
gitea_network:
external: true
services:
caddy_service:
image: caddy
container_name: caddy_container
restart: always
environment:
- TZ=Asia/Shanghai
volumes:
- "./Caddyfile:/etc/caddy/Caddyfile"
- "./conf/:/etc/caddy/conf/"
# - "/home/dj_docker/code/staticfiles/ : /var/www/dj_docker/staticfiles/"
ports:
- "80:80"
- "443:443"
expose:
- "8080"
- "5000"
- "8000"
- "8888"
stdin_open: true
tty: true
privileged: true
networks:
- "gitea_network"
gitea_service:
image: docker.xuanyuan.run/gitea/gitea:latest # 或 rootless 版本
container_name: gitea_container
depends_on:
- caddy_service
restart: unless-stopped
environment:
- USER_UID=1000
- USER_GID=1000
# 数据库(默认 SQLite无需额外服务
- GITEA__database__DB_TYPE=sqlite3
- GITEA__database__PATH=/data/gitea/gitea.db
# 站点
- GITEA__server__DOMAIN=gitea.vlos.net
- GITEA__server__ROOT_URL=https://gitea.vlos.net
- GITEA__server__HTTP_PORT=3000
- GITEA__server__SSH_PORT=222
- GITEA__server__START_SSH_SERVER=true
volumes:
- ./data:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
expose:
- "3000" # 仅内部网络暴露,不对外映射
ports:
- "222:22" # SSH 端口
networks:
- gitea_network