From 676169b0ce046b17201c17042c2e62039e92c9d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E8=A7=85?= Date: Wed, 8 Apr 2026 11:47:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BA=BF=E4=B8=8A=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=20caddy+gitea?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Caddyfile | 10 ++++++++ docker-compose.yml | 60 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 Caddyfile create mode 100644 docker-compose.yml diff --git a/Caddyfile b/Caddyfile new file mode 100644 index 0000000..9fe3d5b --- /dev/null +++ b/Caddyfile @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..dd1adf0 --- /dev/null +++ b/docker-compose.yml @@ -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 \ No newline at end of file