gitea + drone + drone runner + registry 作为 git 服务器,自动测试、构建和打包镜像并发布到私有仓库

Former-commit-id: 5fc019a057ae7a5ff4084610cc6c9314bbad4e30
Former-commit-id: c27ff117a67a3db831cac6d01fb4fc4b101256db
1.0
wanggang 4 years ago
parent 3e822179be
commit 16856a76a2

@ -1,4 +1,17 @@
##
# gitea + drone + drone runner + registry 作为 git 服务器,自动测试、构建和打包镜像并发布到私有仓库
## docker compose 配置网络后才能访问到宿主机 ip
```
networks:
default:
name: mynetwork
driver: bridge
ipam:
config:
- subnet: 172.172.0.0/24
```
## 修改docker配置使用镜像和私有http仓库
修改 /etc/docker/daemon.json 文件的 registry-mirrors 和 insecure-registries属性
```

@ -1,7 +0,0 @@
package main
import "fmt"
func main(){
fmt.Printf("Hello World!");
}

@ -1,18 +1,21 @@
kind: pipeline
name: default
type: docker
steps:
- name: test
image: golang:1.12
commands:
- go test
- ls
- name: build
image: golang:1.12
commands:
- go build
- go test
- ls
- name: publish
image: plugins/docker
settings:
registry: 172.20.32.1:5000
repo: 172.20.32.1:5000/go/hello-world
insecure: true
tags: [ 1, 1.1, latest ]
tags: [ 1, 1.2, latest ]

@ -0,0 +1,3 @@
FROM scratch
ADD example /
ENTRYPOINT ["/example"]

@ -0,0 +1,12 @@
package main
import "fmt"
func main() {
fmt.Println(HelloWorld())
}
// HelloWorld is a function that returns a string containing "hello world".
func HelloWorld() string {
return "hello world"
}

@ -0,0 +1,16 @@
package main
import (
"os"
"testing"
)
func TestMain(m *testing.M) {
os.Exit(m.Run())
}
func TestHelloWorld(t *testing.T) {
if HelloWorld() != "hello world" {
t.Errorf("got %s expected %s", HelloWorld(), "hello world")
}
}

@ -53,8 +53,6 @@ services:
gitea: # init with ip:port https://docs.gitea.io/en-us/install-with-docker
image: gitea/gitea:1.14.2
restart: always
networks:
- default
environment:
- USER_UID=1000
- USER_GID=1000

Loading…
Cancel
Save