diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..17f187b --- /dev/null +++ b/.drone.yml @@ -0,0 +1,52 @@ +kind: pipeline +type: docker +name: master +steps: + - name: restore-cache + image: meltwater/drone-cache + settings: + backend: filesystem + restore: true + cache_key: "gomod" + archive_format: gzip + filesystem_cache_root: "/var/lib/cache" + mount: + - 'mod.pkg' + volumes: + - name: cache + path: "/var/lib/cache" + # Do stuff.. + - name: build + image: golang:1.16-alpine3.13 + environment: + GOMODCACHE: '/drone/src/mod.pkg' + commands: + - GOPROXY=https://goproxy.cn GOSUMDB=off CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags '-w -s' -o bin/server + - name: docker + image: plugins/docker + settings: + dockerfile: "Dockerfile.drone" + repo: harbor.oa00.com/library/image + registry: harbor.oa00.com + username: + from_secret: docker_username + password: + from_secret: docker_password + auto_tag: true + - name: rebuild-cache + image: meltwater/drone-cache + settings: + backend: filesystem + rebuild: true + cache_key: "gomod" + archive_format: gzip + filesystem_cache_root: "/var/lib/cache" + mount: + - 'mod.pkg' + volumes: + - name: cache + path: "/var/lib/cache" +volumes: + - name: cache + host: + path: "/var/lib/cache" \ No newline at end of file diff --git a/README.md b/README.md index e69de29..c1a4a3e 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,3 @@ +| 环境 | 编译 | +| ---- | ---- | +| 正式 | [![Build Status](https://drone.oa00.com/api/badges/ansuex/backend/status.svg?ref=refs/heads/master)](https://drone.oa00.com/ansuex/backend) |