From 5d90dc7717909a8bed879fe76ee28e45bf1b232f Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Tue, 1 Jun 2021 09:46:54 +0800 Subject: [PATCH] docker-registry-ui Former-commit-id: d04a1e48dae2a9938f0a24d6adb3b78c8be1fc29 Former-commit-id: 0fc40f68b6dff8f73359f8dc9b4de8895fe35bf2 --- labs/docker-lan/README.md | 7 ++++-- labs/docker-lan/conf/drone/example/.drone.yml | 23 ++++++++++++------- labs/docker-lan/docker-compose.yml | 18 ++++++++------- 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/labs/docker-lan/README.md b/labs/docker-lan/README.md index 5f86a71d..1645755e 100644 --- a/labs/docker-lan/README.md +++ b/labs/docker-lan/README.md @@ -1,6 +1,5 @@ # gitea + drone + drone runner + registry 作为 git 服务器,自动测试、构建和打包镜像并发布到私有仓库 - ## docker compose 配置网络后才能访问到宿主机 ip ``` networks: @@ -34,4 +33,8 @@ networks: } } } -``` \ No newline at end of file +``` + +## 参考 + +1. drone 环境变量:https://github.com/drone/drone/blob/master/operator/runner/env.go \ No newline at end of file diff --git a/labs/docker-lan/conf/drone/example/.drone.yml b/labs/docker-lan/conf/drone/example/.drone.yml index dd74a8b4..02bc356c 100644 --- a/labs/docker-lan/conf/drone/example/.drone.yml +++ b/labs/docker-lan/conf/drone/example/.drone.yml @@ -1,21 +1,28 @@ kind: pipeline -name: default type: docker +name: default + +platform: + arch: amd64 + os: linux + steps: - name: test - image: golang:1.12 + image: golang:1.16.4 commands: - go test - - ls + - name: build - image: golang:1.12 + image: golang:1.16.4 commands: - - go build - - ls + - go build -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" + - name: publish - image: plugins/docker + image: plugins/docker:19.03.8 settings: registry: 172.20.32.1:5000 repo: 172.20.32.1:5000/go/hello-world insecure: true - tags: [ 1, 1.2, latest ] \ No newline at end of file + tags: + - latest + - ${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}-${DRONE_REPO_BRANCH}-${DRONE_COMMIT_SHA:0:8} \ No newline at end of file diff --git a/labs/docker-lan/docker-compose.yml b/labs/docker-lan/docker-compose.yml index ff3b2281..029d1169 100644 --- a/labs/docker-lan/docker-compose.yml +++ b/labs/docker-lan/docker-compose.yml @@ -34,22 +34,24 @@ services: registry: #https://docs.docker.com/registry/deploying/ image: registry:2.7.1 restart: always + environment: + - REGISTRY_STORAGE_DELETE_ENABLED=true ports: - 5000:5000 #http://localhost:5000/v2/_catalog volumes: - ./data/registry:/var/lib/registry - docker-registry-web: - image: hyper/docker-registry-web:latest + docker-registry-ui: + image: joxit/docker-registry-ui:2.0 restart: always ports: - - 9580:8080 + - 9580:80 + environment: + - REGISTRY_TITLE=${IP}:5000 + - NGINX_PROXY_PASS_URL=http://registry:5000 + - DELETE_IMAGES=true + - SINGLE_REGISTRY=true depends_on: - registry - environment: - - REGISTRY_URL=http://registry:5000/v2 - - REGISTRY_TRUST_ANY_SSL=true - - REGISTRY_BASIC_AUTH=cm9vdDphQTEyMzQ1NiE= - - REGISTRY_NAME=${IP} gitea: # init with ip:port https://docs.gitea.io/en-us/install-with-docker image: gitea/gitea:1.14.2 restart: always