Compare commits
No commits in common. "develop" and "master" have entirely different histories.
22
README.md
22
README.md
|
@ -1,22 +0,0 @@
|
||||||
# Alpine Docker compose service
|
|
||||||
|
|
||||||
## Run docker-compose services as openrc services
|
|
||||||
|
|
||||||
Copy the script init.d/dc to /etc/init.d/dc.
|
|
||||||
|
|
||||||
Each docker-compose based service $SERVICENAME must exist like so:
|
|
||||||
* /srv/docker/$SERVICENAME/docker-compose.yml.
|
|
||||||
|
|
||||||
Finally create some symbolic link :
|
|
||||||
* ln -s /etc/init.d/dockerservice.$SERVICENAME pointing to /etc/init.d/dc.
|
|
||||||
|
|
||||||
Services can now be started/stopped via e.g. /etc/init.d/dockerservice.gitea start.
|
|
||||||
|
|
||||||
## Build an Alpine package
|
|
||||||
|
|
||||||
You need to install "nfpm" (https://nfpm.goreleaser.com/)
|
|
||||||
|
|
||||||
```
|
|
||||||
nfpm pkg --packager apk --target .
|
|
||||||
|
|
||||||
```
|
|
66
init.d/dc
66
init.d/dc
|
@ -1,66 +0,0 @@
|
||||||
#!/sbin/openrc-run
|
|
||||||
|
|
||||||
# From https://github.com/0x17de/dockerservice-openrc
|
|
||||||
|
|
||||||
: ${SUBCFGDIR:=/srv/docker}
|
|
||||||
DOCKER_COMPOSE_UP_ARGS=${DOCKER_COMPOSE_UP_ARGS-"--no-build --no-recreate --no-deps"}
|
|
||||||
|
|
||||||
SUBSVC="${SVCNAME#*.}"
|
|
||||||
[ -z "${SUBSVC}" ] && exit 1
|
|
||||||
: ${SUBCFG:="${SUBCFGDIR}/${SUBSVC}/docker-compose.yml"}
|
|
||||||
DOCOCMD="/usr/bin/docker"
|
|
||||||
export COMPOSE_HTTP_TIMEOUT=300
|
|
||||||
|
|
||||||
description="Manage Docker services defined in ${SUBCFG}"
|
|
||||||
extra_commands="configtest build"
|
|
||||||
description_configtest="Check configuration via \"docker compose -f ${SUBCFG} config\""
|
|
||||||
description_build="Run \"docker compose -f ${SUBCFG} build\""
|
|
||||||
|
|
||||||
depend() {
|
|
||||||
need localmount net docker
|
|
||||||
use dns
|
|
||||||
after docker
|
|
||||||
}
|
|
||||||
|
|
||||||
configtest() {
|
|
||||||
if ! [ -f "${SUBCFG}" ]; then
|
|
||||||
eerror "The config file ${SUBCFG} does not exist!"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
"${DOCOCMD}" -f "${SUBCFG}" config >&/dev/null
|
|
||||||
if [ ${?} -ne 0 ]; then
|
|
||||||
einfo "config: ok"
|
|
||||||
else
|
|
||||||
eerror "config: error"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
build() {
|
|
||||||
configtest || return 1
|
|
||||||
ebegin "Building dockerservice ${SUBSVC}"
|
|
||||||
"${DOCOCMD}" compose -f "${SUBCFG}" build
|
|
||||||
eend $?
|
|
||||||
}
|
|
||||||
|
|
||||||
start() {
|
|
||||||
configtest || return 1
|
|
||||||
ebegin "Starting dockerservice ${SUBSVC}"
|
|
||||||
"${DOCOCMD}" compose -f "${SUBCFG}" up -d ${DOCKER_COMPOSE_UP_ARGS}
|
|
||||||
eend $?
|
|
||||||
}
|
|
||||||
|
|
||||||
stop() {
|
|
||||||
ebegin "Stopping dockerservice ${SUBSVC}"
|
|
||||||
"${DOCOCMD}" compose -f "${SUBCFG}" stop --timeout=300
|
|
||||||
eend $?
|
|
||||||
}
|
|
||||||
|
|
||||||
status() {
|
|
||||||
if [ "$("${DOCOCMD}" compose -f "${SUBCFG}" top | wc -l)" -gt "0" ]; then
|
|
||||||
einfo "status: started"
|
|
||||||
else
|
|
||||||
einfo "status: stopped"
|
|
||||||
return 3
|
|
||||||
fi
|
|
||||||
}
|
|
33
nfpm.yaml
33
nfpm.yaml
|
@ -1,33 +0,0 @@
|
||||||
# nfpm example config file
|
|
||||||
#
|
|
||||||
# check https://nfpm.goreleaser.com/configuration for detailed usage
|
|
||||||
#
|
|
||||||
|
|
||||||
name: "dcservice"
|
|
||||||
arch: "amd64"
|
|
||||||
platform: "linux"
|
|
||||||
version: "v0.0.1"
|
|
||||||
section: "default"
|
|
||||||
priority: "extra"
|
|
||||||
maintainer: "Cadoles <contact@cadoles.com>"
|
|
||||||
description: |
|
|
||||||
Docker Compose Openrc Services
|
|
||||||
vendor: "Cadoles"
|
|
||||||
homepage: "https://www.cadoles.com"
|
|
||||||
license: "GPL-v3"
|
|
||||||
changelog: "changelog.yaml"
|
|
||||||
|
|
||||||
contents:
|
|
||||||
- src: init.d/dc
|
|
||||||
dst: /etc/init.d/dc
|
|
||||||
- src: services
|
|
||||||
dst: /srv/docker
|
|
||||||
- src: init.d/dc
|
|
||||||
dst: /etc/init.d/dc.jslave
|
|
||||||
type: symlink
|
|
||||||
|
|
||||||
overrides:
|
|
||||||
apk:
|
|
||||||
depends:
|
|
||||||
- docker-compose
|
|
||||||
- docker
|
|
|
@ -1,9 +0,0 @@
|
||||||
version: "3.9"
|
|
||||||
services:
|
|
||||||
jslave:
|
|
||||||
env_file:
|
|
||||||
- /etc/jslave/jslave.conf
|
|
||||||
image: "reg.cadoles.com/cadoles/jenkins-slave:latest"
|
|
||||||
volumes:
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
- /srv/jenkins/workspace:/workspace
|
|
Loading…
Reference in New Issue