Docker 搭建 Gogs
由于gogs 要依赖Mysql 所以我这里直接用 docker-compose 进行多容器安装启动了。
具体 docker-compose.yml 如下:
version: "3"
services:
mysql:
image: mysql:5.7
restart: always
environment:
- MYSQL_ROOT_PASSWORD=gogs
- MYSQL_USER=gogs
- MYSQL_PASSWORD=gogs
- MYSQL_DATABASE=gogs
ports:
- "10036:3306"
volumes:
- ./mysql:/var/lib/mysq
networks:
gogs_app:
aliases:
- mysql
gogs:
image: gogs/gogs:latest
container_name: gogs
restart: always
ports:
- "8082:3000"
- "10022:22"
depends_on:
- mysql
volumes:
- ./data:/data
networks:
gogs_app:
aliases:
- gogs_main
networks:
gogs_app:
Docker 安装 drone
参考
為什麼我用 Drone 取代 Jenkins 及 GitLab CI
docker-compose 方式安装:
version: '3'
services:
drone-server:
image: drone/drone:1.2.1
ports:
- "8083:80"
volumes:
- ./drone:/var/lib/drone/
environment:
- DRONE_OPEN=true
- DRONE_SERVER_HOST=47.99.212.97:8083
- DRONE_DEBUG=true
- DRONE_GIT_ALWAYS_AUTH=false
- DRONE_GOGS=true
- DRONE_GOGS_SKIP_VERIFY=false
- DRONE_GOGS_SERVER=http://47.99.212.97:8082
- DRONE_PROVIDER=gogs
- DRONE_SERVER_PROTO=http
- DRONE_RPC_SECRET=6d77513f7c989178c72c64acfb0561c6
- DRONE_RUNNER_CAPACITY=2
- DRONE_AGENTS_ENABLED=true
drone-agent:
image: drone/agent:1.2.1
depends_on:
- drone-server
environment:
- DRONE_RPC_SERVER=http://47.99.212.97:8083
- DRONE_RPC_SECRET=6d77513f7c989178c72c64acfb0561c6
- DRONE_SERVER=http://47.99.212.97:8083
- DRONE_DEBUG=true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
docker 命令行安装运行
docker run \
--volume=/var/lib/drone:/data \
--env=DRONE_GOGS_SERVER=http://47.99.212.97:8082 \
--env=DRONE_RPC_SECRET=111111 \
--env=DRONE_SERVER_HOST=http://47.99.212.97:8083 \
--env=DRONE_SERVER_PROTO=http \
--publish=8083:8000 \
--restart=always \
--detach=true \
--name=drone \
drone/drone:1
drone+gogs 记录坑处:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running