mirror of
https://github.com/spritsail/alpine.git
synced 2024-12-20 11:34:36 +00:00
Build amd64/arm64 multiarch images
Signed-off-by: Adam Dodman <adam@adam-ant.co.uk> Signed-off-by: Joe Groocock <me@frebib.net> Signed-off-by: Joe Groocock <jgroocock@cloudflare.com>
This commit is contained in:
parent
fa09f2867c
commit
e50739bb32
86
.drone.star
86
.drone.star
@ -1,15 +1,40 @@
|
|||||||
def main(ctx):
|
repo = "spritsail/alpine"
|
||||||
return [
|
archs = ["amd64", "arm64"]
|
||||||
step("3.15"),
|
branches = ["master"]
|
||||||
step("3.16",["latest"]),
|
versions = {
|
||||||
step("edge"),
|
"3.14": [],
|
||||||
]
|
"3.15": [],
|
||||||
|
"3.16": ["latest"],
|
||||||
|
"edge": [],
|
||||||
|
}
|
||||||
|
|
||||||
def step(alpinever,tags=[]):
|
def main(ctx):
|
||||||
vertest = "grep -q '%s' /etc/alpine-release && " % alpinever if alpinever != "edge" else ""
|
builds = []
|
||||||
|
|
||||||
|
for ver, tags in versions.items():
|
||||||
|
depends_on = []
|
||||||
|
for arch in archs:
|
||||||
|
key = "build-%s-%s" % (ver, arch)
|
||||||
|
builds.append(step(ver, arch, key))
|
||||||
|
depends_on.append(key)
|
||||||
|
|
||||||
|
if ctx.build.branch in branches:
|
||||||
|
builds.append(publish(ver, depends_on, tags))
|
||||||
|
|
||||||
|
return builds
|
||||||
|
|
||||||
|
def step(ver, arch, key):
|
||||||
|
vertest = "grep -q '%s' /etc/alpine-release && " % ver if ver != "edge" else ""
|
||||||
return {
|
return {
|
||||||
"kind": "pipeline",
|
"kind": "pipeline",
|
||||||
"name": "build-%s" % alpinever,
|
"name": key,
|
||||||
|
"platform": {
|
||||||
|
"os": "linux",
|
||||||
|
"arch": arch,
|
||||||
|
},
|
||||||
|
"environment": {
|
||||||
|
"DOCKER_IMAGE_TOKEN": ver,
|
||||||
|
},
|
||||||
"steps": [
|
"steps": [
|
||||||
{
|
{
|
||||||
"name": "build",
|
"name": "build",
|
||||||
@ -17,7 +42,7 @@ def step(alpinever,tags=[]):
|
|||||||
"pull": "always",
|
"pull": "always",
|
||||||
"settings": {
|
"settings": {
|
||||||
"build_args": [
|
"build_args": [
|
||||||
"ALPINE_TAG=%s" % alpinever,
|
"ALPINE_TAG=%s" % ver,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -27,6 +52,7 @@ def step(alpinever,tags=[]):
|
|||||||
"pull": "always",
|
"pull": "always",
|
||||||
"settings": {
|
"settings": {
|
||||||
"run": vertest + "su-exec nobody apk --version",
|
"run": vertest + "su-exec nobody apk --version",
|
||||||
|
"verbose": "true",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -34,16 +60,46 @@ def step(alpinever,tags=[]):
|
|||||||
"image": "spritsail/docker-publish",
|
"image": "spritsail/docker-publish",
|
||||||
"pull": "always",
|
"pull": "always",
|
||||||
"settings": {
|
"settings": {
|
||||||
"repo": "spritsail/alpine",
|
"registry": {"from_secret": "registry_url"},
|
||||||
"tags": [alpinever] + tags,
|
"login": {"from_secret": "registry_login"},
|
||||||
"username": {"from_secret": "docker_username"},
|
|
||||||
"password": {"from_secret": "docker_password"},
|
|
||||||
},
|
},
|
||||||
"when": {
|
"when": {
|
||||||
"branch": ["master"],
|
"branch": branches,
|
||||||
"event": ["push"],
|
"event": ["push"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def publish(ver, depends, tags=[]):
|
||||||
|
return {
|
||||||
|
"kind": "pipeline",
|
||||||
|
"name": "publish-%s" % ver,
|
||||||
|
"depends_on": depends,
|
||||||
|
"platform": {
|
||||||
|
"os": "linux",
|
||||||
|
},
|
||||||
|
"environment": {
|
||||||
|
"DOCKER_IMAGE_TOKEN": ver,
|
||||||
|
},
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"name": "publish",
|
||||||
|
"image": "spritsail/docker-multiarch-publish",
|
||||||
|
"pull": "always",
|
||||||
|
"settings": {
|
||||||
|
"src_registry": {"from_secret": "registry_url"},
|
||||||
|
"src_login": {"from_secret": "registry_login"},
|
||||||
|
"dest_repo": repo,
|
||||||
|
"dest_login": {"from_secret": "docker_login"},
|
||||||
|
"tags": [ver] + tags,
|
||||||
|
},
|
||||||
|
"when": {
|
||||||
|
"branch": branches,
|
||||||
|
"event": ["push"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: ft=python sw=2
|
||||||
|
Loading…
Reference in New Issue
Block a user