Skip to content

Commit f05761f

Browse files
段洪义段洪义
authored andcommitted
chore(drone): add drone config
1 parent 6f52d93 commit f05761f

3 files changed

Lines changed: 130 additions & 1 deletion

File tree

.drone/drone.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
kind: pipeline
2+
type: docker
3+
name: linux-amd64
4+
5+
platform:
6+
arch: amd64
7+
os: linux
8+
9+
steps:
10+
- name: test
11+
image: docker.io/library/docker:dind
12+
privileged: true
13+
commands:
14+
- nohup dockerd &
15+
- apk add make bash curl
16+
- make test
17+
environment:
18+
DEV_REGISTRY:
19+
from_secret: dev_registry
20+
21+
- name: publish
22+
image: docker.io/library/docker:dind
23+
privileged: true
24+
commands:
25+
- nohup dockerd &
26+
- apk add make bash curl
27+
- echo $DOCKER_PASSWORD | docker login --username $DOCKER_USERNAME --password-stdin
28+
- make build push
29+
environment:
30+
DEV_REGISTRY:
31+
from_secret: dev_registry
32+
when:
33+
event:
34+
- push
35+
- tag
36+
37+
---
38+
kind: pipeline
39+
type: docker
40+
name: linux-arm64
41+
42+
platform:
43+
arch: arm64
44+
os: linux
45+
46+
steps:
47+
- name: test
48+
image: docker.io/library/docker:dind
49+
privileged: true
50+
commands:
51+
- nohup dockerd &
52+
- apk add make bash curl
53+
- make test
54+
environment:
55+
DEV_REGISTRY:
56+
from_secret: dev_registry
57+
58+
- name: publish
59+
image: docker.io/library/docker:dind
60+
privileged: true
61+
commands:
62+
- nohup dockerd &
63+
- apk add make bash curl
64+
- echo $DOCKER_PASSWORD | docker login --username $DOCKER_USERNAME --password-stdin
65+
- make build push
66+
environment:
67+
DEV_REGISTRY:
68+
from_secret: dev_registry
69+
DOCKER_USERNAME:
70+
from_secret: docker_username
71+
DOCKER_PASSWORD:
72+
from_secret: docker_password
73+
when:
74+
event:
75+
- push
76+
- tag
77+
78+
-
79+
nd: pipeline
80+
type: docker
81+
name: manifest
82+
83+
steps:
84+
- name: manifest
85+
image: docker.io/library/alpine
86+
commands:
87+
- sed -i "s/docker.io/$${DRYCC_REGISTRY}/g" ./drone/manifest.tmpl
88+
environment:
89+
DRYCC_REGISTRY:
90+
from_secret: drycc_registry
91+
92+
- name: publish
93+
image: plugins/manifest
94+
settings:
95+
spec: .drone/manifest.tmpl
96+
username:
97+
from_secret: docker_username
98+
password:
99+
from_secret: docker_password
100+
environment:
101+
DEV_REGISTRY:
102+
from_secret: dev_registry
103+
104+
when:
105+
event:
106+
- push
107+
- tag
108+
109+
depends_on:
110+
- linux-amd64
111+
- linux-arm64

.drone/manifest.tmpl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
image: docker.io/drycc/registry:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
2+
{{#if build.tags}}
3+
tags:
4+
{{#each build.tags}}
5+
- {{this}}
6+
{{/each}}
7+
{{/if}}
8+
manifests:
9+
-
10+
image: docker.io/drycc/registry:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest-{{/if}}linux-amd64
11+
platform:
12+
architecture: amd64
13+
os: linux
14+
-
15+
image: docker.io/drycc/registry:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest-{{/if}}linux-arm64
16+
platform:
17+
architecture: arm64
18+
os: linux

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
VERSION ?= $(shell git describe --tags --exact-match 2>/dev/null || echo latest)
2-
REGISTRY ?= docker.io
2+
DEV_REGISTRY ?= docker.io
33
IMAGE_PREFIX ?= drycc
44
IMAGE := ${DEV_REGISTRY}/${IMAGE_PREFIX}/go-dev:${VERSION}
55
PLATFORM ?= linux/amd64,linux/arm64

0 commit comments

Comments
 (0)