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"