Fix Drone pipeline.
This commit is contained in:
parent
a9e910ae6b
commit
692c08d22e
26
.drone.yml
26
.drone.yml
|
@ -18,18 +18,20 @@ name: "build toolbox"
|
|||
trigger:
|
||||
event: ["tag"]
|
||||
|
||||
depends_on:
|
||||
- "lint"
|
||||
|
||||
steps:
|
||||
- name: "build toolbox"
|
||||
image: "docker:20.10.17-dind"
|
||||
image: "code.pztrn.name/containers/mirror/docker:26.1.1-dind"
|
||||
pull: if-not-exists
|
||||
settings:
|
||||
privileged: true
|
||||
environment:
|
||||
REGISTRY: code.pztrn.name
|
||||
REGISTRY_PROJECT: /containers/go-toolbox
|
||||
REGISTRY_USERNAME: drone
|
||||
REGISTRY_PASSWORD:
|
||||
from_secret: drone_secret
|
||||
commands:
|
||||
- apk add --no-cache bash
|
||||
- ./build.sh
|
||||
privileged: true
|
||||
environment:
|
||||
REGISTRY: code.pztrn.name
|
||||
REGISTRY_PROJECT: /containers/go-toolbox
|
||||
REGISTRY_USERNAME: drone
|
||||
REGISTRY_PASSWORD:
|
||||
from_secret: drone_secret
|
||||
commands:
|
||||
- apk add --no-cache bash
|
||||
- ./build.sh
|
||||
|
|
16
build.sh
Normal file → Executable file
16
build.sh
Normal file → Executable file
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
# build.sh checks if docker image with same sha256 exists remotely.
|
||||
# if exists, do nothing, if not, build the image
|
||||
|
@ -12,6 +12,20 @@ else
|
|||
tag="${DRONE_COMMIT_SHA}"
|
||||
fi
|
||||
|
||||
# Starting Docker daemon.
|
||||
/usr/local/bin/dockerd --data-root=/var/lib/docker --max-concurrent-uploads 1 &
|
||||
|
||||
# Wait for it.
|
||||
echo "* Waiting for Docker daemon to start..."
|
||||
while true; do
|
||||
if docker ps &>/dev/null; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
echo "* Logging in to registry..."
|
||||
docker login -u "${REGISTRY_USERNAME}" -p "${REGISTRY_PASSWORD}" "${REGISTRY}"
|
||||
|
||||
echo "* Building docker image ${image_path}:${tag}..."
|
||||
|
||||
if docker manifest inspect "${image_path}:${tag}" >/dev/null; then
|
||||
|
|
Loading…
Reference in New Issue
Block a user