drone/drone-starlark/repos/build.star

24 lines
667 B
Plaintext
Raw Normal View History

2020-05-10 16:16:11 +00:00
load("@this//:environment.star", "environment")
def build(name):
return {
"name": "build-{name}".format(name=name),
"image": "docker:dind",
"volumes": [
{
"name": "dockersock",
"path": "/var/run",
},
],
"environment": environment([
"local-docker-registry",
2020-05-11 13:37:26 +00:00
"registry-password"
2020-05-10 16:16:11 +00:00
]),
"commands": [
"cd {name}".format(name=name),
2020-05-11 14:08:31 +00:00
'docker login $${LOCAL_DOCKER_REGISTRY} --username client --password "$${REGISTRY_PASSWORD}"',
2020-05-10 16:16:11 +00:00
"docker build . -t $${{LOCAL_DOCKER_REGISTRY}}{name}".format(name=name),
"docker push $${{LOCAL_DOCKER_REGISTRY}}{name}".format(name=name),
],
}