Manuel Friedli
f136fa5436
Also, make all files in files/ non-executable. Package-Manager: Portage-2.3.66, Repoman-2.3.11
62 lines
1.8 KiB
Text
62 lines
1.8 KiB
Text
#!/sbin/openrc-run
|
|
# Copyright 2016-2019 Gentoo Authors
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
|
|
description="Drone CI - Automate software testing and delivery"
|
|
|
|
container_name_file=/var/run/drone-container.name
|
|
|
|
: ${DRONE_GITEA_SERVER:=http://localhost/
|
|
: ${DRONE_SERVER_HOST:=localhost}
|
|
: ${DRONE_SERVER_PROTO:=https}
|
|
: ${DRONE_GITEA_CLIENT_ID:=}
|
|
: ${DRONE_GITEA_CLIENT_SECRET:=}
|
|
: ${DOCKER_SOCKET:=/var/run/docker.sock}
|
|
# fixme this must be done better, in a more generic way
|
|
: ${MYSQL_SOCKET:=/var/run/mysqld/mysqld.sock}
|
|
: ${DRONE_DATABASE_DATASOURCE:=/data/drone.sqlite}
|
|
: ${DRONE_DATABASE_DRIVER:=sqlite}
|
|
: ${DRONE_RUNNER_CAPACITY:=2}
|
|
: ${DRONE_GIT_ALWAYS_AUTH:=false}
|
|
: ${DRONE_TLS_AUTOCERT:=false}
|
|
: ${DRONE_PUBLISH_PORT:=80:80}
|
|
|
|
depend() {
|
|
need docker
|
|
after mysql
|
|
}
|
|
|
|
pre_start() {
|
|
docker pull drone/drone:1.1.0
|
|
}
|
|
|
|
start() {
|
|
docker run \
|
|
--volume=${DOCKER_SOCKET}:${DOCKER_SOCKET} \
|
|
--volume=${MYSQL_SOCKET}:${MYSQL_SOCKET} \
|
|
--env=DRONE_GITEA_SERVER=${DRONE_GITEA_SERVER} \
|
|
--env=DRONE_GITEA_CLIENT_ID=${DRONE_GITEA_CLIENT_ID} \
|
|
--env=DRONE_GITEA_CLIENT_SECRET=${DRONE_GITEA_CLIENT_SECRET} \
|
|
--env=DRONE_GIT_ALWAYS_AUTH=${DRONE_GIT_ALWAYS_AUTH} \
|
|
--env=DRONE_RUNNER_CAPACITY=${DRONE_RUNNER_CAPACITY} \
|
|
--env=DRONE_SERVER_HOST=${DRONE_SERVER_HOST} \
|
|
--env=DRONE_SERVER_PROTO=${DRONE_SERVER_PROTO} \
|
|
--env=DRONE_TLS_AUTOCERT=${DRONE_TLS_AUTOCERT} \
|
|
--env=DRONE_DATABASE_DATASOURCE="${DRONE_DATABASE_DATASOURCE}" \
|
|
--env=DRONE_DATABASE_DRIVER=${DRONE_DATABASE_DRIVER} \
|
|
--publish=${DRONE_PUBLISH_PORT} \
|
|
--restart=always \
|
|
--detach=true \
|
|
--name=drone \
|
|
drone/drone:1.1.0 \
|
|
> ${container_name_file}
|
|
}
|
|
|
|
stop() {
|
|
docker container stop $(cat ${container_name_file})
|
|
}
|
|
|
|
stop_post() {
|
|
docker container rm $(cat ${container_name_file})
|
|
rm ${container_name_file}
|
|
}
|