add drone, add logic for init scripts

This commit is contained in:
MrMeeb 2022-12-27 11:44:51 +00:00
parent ee7034cba3
commit cad9b48ab9
2 changed files with 67 additions and 0 deletions

41
.drone.yml Normal file
View File

@ -0,0 +1,41 @@
kind: pipeline
type: docker
name: build-multiarch-images
platform:
os: linux
arch: amd64
steps:
- name: make-tags
image: node
commands:
- echo -n "${DRONE_COMMIT_SHA:0:10}, latest" > .tags
- name: build
image: thegeeklab/drone-docker-buildx
privileged: true
settings:
registry: git.mrmeeb.stream
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: git.mrmeeb.stream/mrmeeb/certbot-cron
platforms:
- linux/arm64
- linux/amd64
- name: notify
image: plugins/slack
settings:
webhook:
from_secret: slack_webhook
trigger:
branch:
- main
event:
exclude:
- pull_request

26
run.sh
View File

@ -1,9 +1,34 @@
#!/bin/bash
#Importing and running additional scripts placed in /config/init
if [ -d /config/init ]
then
if [ "$(ls -A /config/init)" ]
then
echo "Running additional startup scripts"
bash /config/init/*
else
echo "/config/init is empty - no additional startup scripts detected"
fi
else
echo "Directory /config/init not found. Recreating."
mkdir /config/init
fi
#Copying config.json to /config if it isn't there already, then linking it back into Cronicle
mv -n /opt/cronicle/conf/config.json /config/config.json
rm -rf /opt/cronicle/conf/config.json
ln -s /config/config.json /opt/cronicle/conf/config.json
#Detecting what mode Cronicle should be started in
if [ $MODE == "manager" ]
then
echo "Cronicle is running in 'manager' mode"
@ -32,6 +57,7 @@ then
elif [ $MODE == "worker" ]
then
echo "Cronicle is running in 'worker' mode"
exec node /opt/cronicle/lib/main.js --color 1