dev-util/drone-runner-docker: Initial add
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is passing

Package-Manager: Portage-3.0.4, Repoman-3.0.1
This commit is contained in:
Manuel Friedli 2020-09-26 01:30:29 +02:00
parent 5d9b9bf322
commit cd6b8380be
7 changed files with 133 additions and 0 deletions

View file

@ -0,0 +1,19 @@
# Drone docker runner configuration file. See
# https://docs.drone.io/runner/docker/configuration/reference/ for a complete
# list of configuration options.
# provides the hostname (and optional port) of your Drone server. The runner connects to the server at the host address to receive pipelines for execution.
DRONE_RPC_HOST="drone.example.com"
# provides the protocol used to connect to your Drone server. The value must be either http or https.
DRONE_RPC_PROTO="https"
# provides the shared secret used to authenticate with your Drone server. This must match the secret defined in your Drone server configuration.
DRONE_RPC_SECRET="your-secret-goes-here"
# Required string value configures ports to publish for docker: space-separated
# list of <hostport>:<containerport> tuples.
DOCKER_PUBLISH="3000:3000"
# Optional string value of extra args passed verbatim to the docker command.
DOCKER_DRONE_EXTRA_ARGS=""

View file

@ -0,0 +1,21 @@
[Unit]
Description=drone.io docker runner
Documentation=https://docs.drone.io/
After=network.target
Requires=network.target
[Service]
User=drone-runner-docker
Group=drone-runner-docker
Environment="RUNNER_CONFIG_FILE=/etc/drone-runner-docker/app.ini"
ExecStart=drone-runner-docker.sh
ExecStop=docker container stop drone-runner
ExecStop=docker container rm drone-runner
Restart=on-failure
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,29 @@
#!/bin/sh
# $RUNNER_CONFIG_FILE contains path to the config file
if [[ -z "${RUNNER_CONFIG_FILE}" ]] ; then
echo "RUNNER_CONFIG_FILE not set!"
exit 1
fi
. "${RUNNER_CONFIG_FILE}"
docker_args=""
for var in "${!DRONE_@}" ; do
docker_args="${docker_args} --env=${var}=${!var}"
done
for p in ${DOCKER_PUBLISH} ; do
docker_args="${docker_args} --publish=${p}"
done
docker_args="${docker_args} ${DOCKER_DRONE_EXTRA_ARGS}"
docker run \
--volume=/run/docker.sock:/var/run/docker.sock \
${docker_args} \
--restart=always \
--detach=false \
--name=drone-runner \
drone/drone-runner-docker:<VERSION>