Files
zkxw/测试环境部署/drone/docker-compose.yml
T

58 lines
2.2 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Drone CI(对接本机 Gogs)— 部署到测试机 /root/drone/
# 用法:
# cp .env.example .env # 填写 DRONE_RPC_SECRET
# docker compose up -d
#
# 访问:http://101.35.245.122:18088 (用 Gogs 用户名/密码登录)
# Gogs:http://101.35.245.122:3000
#
# 流水线:仅 tag → 生产 Docker 交付包 → /root/zkxw-releases/
services:
drone:
image: drone/drone:2
container_name: drone
restart: always
ports:
- '18088:80'
volumes:
- drone-data:/data
environment:
DRONE_AGENTS_ENABLED: 'true'
DRONE_GOGS_SERVER: ${DRONE_GOGS_SERVER:-http://101.35.245.122:3000}
DRONE_GOGS_SKIP_VERIFY: ${DRONE_GOGS_SKIP_VERIFY:-false}
DRONE_RPC_SECRET: ${DRONE_RPC_SECRET}
DRONE_SERVER_HOST: ${DRONE_SERVER_HOST:-101.35.245.122:18088}
DRONE_SERVER_PROTO: ${DRONE_SERVER_PROTO:-http}
DRONE_GIT_ALWAYS_AUTH: ${DRONE_GIT_ALWAYS_AUTH:-false}
extra_hosts:
- '101.35.245.122:host-gateway'
- 'host.docker.internal:host-gateway'
runner:
image: drone/drone-runner-docker:1
container_name: drone-runner
restart: always
depends_on:
- drone
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
DRONE_RPC_PROTO: ${DRONE_RPC_PROTO:-http}
DRONE_RPC_HOST: ${DRONE_RPC_HOST:-drone:80}
DRONE_RPC_SECRET: ${DRONE_RPC_SECRET}
DRONE_RUNNER_CAPACITY: ${DRONE_RUNNER_CAPACITY:-1}
DRONE_RUNNER_NAME: ${DRONE_RUNNER_NAME:-zkxw-test-1}
# 允许流水线挂载 docker.sock / 发版目录 / Maven 公共仓库(host volume allowlist)
# zkxw → /releases;杭州第一技师 → /hzdyjs-releases;Java 依赖 → /maven-repo
# 注意:流水线 yaml 勿再声明相同容器路径,否则 Duplicate mount point
DRONE_RUNNER_VOLUMES: /var/run/docker.sock:/var/run/docker.sock,/root/zkxw-releases:/releases,/root/hzdyjs-releases:/hzdyjs-releases,/root/maven-repo:/maven-repo
# 允许 privileged 步骤(docker build)
DRONE_RUNNER_PRIVILEGED_IMAGES: docker:27-cli,docker:24-cli,docker:dind
extra_hosts:
- '101.35.245.122:host-gateway'
- 'host.docker.internal:host-gateway'
volumes:
drone-data: