allow for extra cron commands after initial

pull/61/head
modem7 2022-08-19 00:04:59 +01:00
rodzic 53133a92fb
commit 61eb0d557f
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 780D7218B8D553A3
8 zmienionych plików z 83 dodań i 54 usunięć

Wyświetl plik

@ -7,7 +7,7 @@ name: FullBuild
platform:
os: linux
arch: amd64
steps:
- name: Lint Dockerfile
image: hadolint/hadolint:latest-alpine
@ -19,14 +19,15 @@ steps:
- name: FullBuild
image: thegeeklab/drone-docker-buildx
privileged: true
settings:
repo: ${DRONE_REPO}
repo: modem7/borgmatic-docker
purge: true
compress: true
use_cache: true
no_cache: false
build_args: BUILDKIT_INLINE_CACHE=1
cache_from: ${DRONE_REPO}:latest
Dockerfile: base-fullbuild/Dockerfile
cache_from: modem7/borgmatic-docker:latest
dockerfile: base-fullbuild/Dockerfile
context: base-fullbuild/
platforms: # if it doesn't work run docker run --privileged --rm tonistiigi/binfmt --install all
- linux/amd64
@ -48,7 +49,7 @@ steps:
from_secret: docker_password
PUSHRM_FILE: README.md
PUSHRM_SHORT: Multiarch Borgmatic with docker-cli
PUSHRM_TARGET: ${DRONE_REPO}
PUSHRM_TARGET: modem7/borgmatic-docker
when:
status:
- success
@ -71,6 +72,9 @@ kind: pipeline
type: docker
name: Dockercli
clone:
depth: 1
platform:
os: linux
arch: amd64
@ -80,13 +84,13 @@ steps:
image: thegeeklab/drone-docker-buildx
privileged: true
settings:
repo: ${DRONE_REPO}
repo: modem7/borgmatic-docker
purge: true
compress: true
use_cache: true
no_cache: false
build_args: BUILDKIT_INLINE_CACHE=1
cache_from: ${DRONE_REPO}:dockercli
Dockerfile: base-dockercli/Dockerfile
cache_from: modem7/borgmatic-docker:dockercli
dockerfile: base-dockercli/Dockerfile
context: base-dockercli/
platforms: # if it doesn't work run docker run --privileged --rm tonistiigi/binfmt --install all
- linux/amd64
@ -119,6 +123,9 @@ kind: pipeline
type: docker
name: LiveInstall
clone:
depth: 1
platform:
os: linux
arch: amd64
@ -128,13 +135,13 @@ steps:
image: thegeeklab/drone-docker-buildx
privileged: true
settings:
repo: ${DRONE_REPO}
repo: modem7/borgmatic-docker
purge: true
compress: true
use_cache: true
no_cache: false
build_args: BUILDKIT_INLINE_CACHE=1
cache_from: ${DRONE_REPO}:liveinstall
Dockerfile: base-liveinstall/Dockerfile
cache_from: modem7/borgmatic-docker:liveinstall
dockerfile: base-liveinstall/Dockerfile
context: base-liveinstall/
platforms: # if it doesn't work run docker run --privileged --rm tonistiigi/binfmt --install all
- linux/amd64

Wyświetl plik

@ -1,7 +1,9 @@
# syntax = docker/dockerfile:latest
FROM modem7/borgmatic-docker:latest
COPY --chmod=755 --link entry.sh /
RUN apk add --update --no-cache \
docker-cli
CMD ["/entry.sh"]

Wyświetl plik

@ -1,17 +1,11 @@
#!/bin/sh
# Generate Cron variables
export CRON=${CRON:-"0 1 * * *"}
export CRON_COMMAND=${CRON_COMMAND:-"borgmatic --stats -v 0 2>&1"}
# Output cron settings to console
echo "Cron job set as: \"$CRON $CRON_COMMAND\""
#!/bin/bash
# Version variables
dockerver=$(docker --version | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')
borgver=$(borg --version)
borgmaticver=$(borgmatic --version)
apprisever=$(apprise --version | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')
crontab=$(crontab -l)
# Software versions
echo docker $dockerver
@ -19,6 +13,19 @@ echo borgmatic $borgmaticver
echo $borgver
echo apprise $apprisever
# Start cron
# Generate Cron variables
CRON="${CRON:-"0 1 * * *"}"
CRON_COMMAND="${CRON_COMMAND:-"borgmatic --stats -v 0 2>&1"}"
# Apply cron variables
echo "$CRON $CRON_COMMAND" > /etc/crontabs/root
if [ -v EXTRA_CRON ]
then
echo "$EXTRA_CRON" >> /etc/crontabs/root
fi
# Output cron settings to console
printf "Cron job set as: \n$crontab\n"
# Start Cron
/usr/sbin/crond -f -L /dev/stdout

Wyświetl plik

@ -1,5 +0,0 @@
data/.cache/
data/.config/
data/.ssh/
data/repository/
.env

Wyświetl plik

@ -12,7 +12,8 @@ VOLUME /root/.cache/borg
HEALTHCHECK --interval=30s --timeout=10s --start-period=20s --retries=3 CMD borgmatic --version || exit 1
RUN <<EOF
set -x
apk add -U --no-cache \
apk update
apk add --no-cache -U \
tzdata \
sshfs \
openssl \
@ -31,9 +32,10 @@ RUN <<EOF
bash-doc
EOF
COPY --chmod=755 --link entry.sh /
COPY --link requirements.txt /
RUN --mount=type=cache,target=/root/.cache python3 -m pip install -Ur requirements.txt
COPY --chmod=755 --link entry.sh /
RUN --mount=type=cache,id=pip,target=/root/.cache,sharing=locked python3 -m pip install -Ur requirements.txt
RUN <<EOF
set -x
borgmatic --bash-completion > /usr/share/bash-completion/completions/borgmatic

Wyświetl plik

@ -1,22 +1,29 @@
#!/bin/sh
# Generate Cron variables
export CRON=${CRON:-"0 1 * * *"}
export CRON_COMMAND=${CRON_COMMAND:-"borgmatic --stats -v 0 2>&1"}
# Output cron settings to console
echo "Cron job set as: \"$CRON $CRON_COMMAND\""
#!/bin/bash
# Version variables
borgver=$(borg --version)
borgmaticver=$(borgmatic --version)
apprisever=$(apprise --version | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')
crontab=$(crontab -l)
# Software versions
echo borgmatic $borgmaticver
echo $borgver
echo apprise $apprisever
# Start cron
# Generate Cron variables
CRON="${CRON:-"0 1 * * *"}"
CRON_COMMAND="${CRON_COMMAND:-"borgmatic --stats -v 0 2>&1"}"
# Apply cron variables
echo "$CRON $CRON_COMMAND" > /etc/crontabs/root
if [ -v EXTRA_CRON ]
then
echo "$EXTRA_CRON" >> /etc/crontabs/root
fi
# Output cron settings to console
printf "Cron job set as: \n$crontab\n"
# Start Cron
/usr/sbin/crond -f -L /dev/stdout

Wyświetl plik

@ -1,6 +1,8 @@
# syntax = docker/dockerfile:latest
FROM modem7/borgmatic-docker:latest
COPY --chmod=755 --link entry.sh /
COPY --chmod=755 --link wtfc.sh /
CMD ["/entry.sh"]

Wyświetl plik

@ -1,19 +1,16 @@
#!/bin/sh
#!/bin/bash
# Generate Cron variables
export CRON=${CRON:-"0 1 * * *"}
export CRON_COMMAND=${CRON_COMMAND:-"borgmatic --stats -v 0 2>&1"}
# Variables
# Version variables
dockerver=$(docker --version | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')
borgver=$(borg --version)
borgmaticver=$(borgmatic --version)
apprisever=$(apprise --version | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')
crontab=$(crontab -l)
# Wait for internet connection
echo "Waiting for Internet connection...."
./wtfc.sh -Q -T 5 ping -c 4 www.google.com
echo "Internet connection established"
echo "Waiting for Internet connection...."
./wtfc.sh -Q -T 5 ping -c 4 www.google.com
echo "Internet connection established"
# Check variable to see if present, echo result
if [ -z "$LIVEINSTALL" ]
@ -26,15 +23,25 @@ fi
# Installing packages
apk update -q && apk add --no-cache -q ${LIVEINSTALL:-docker-cli}
# Output cron settings to console
echo "Cron job set as: \"$CRON $CRON_COMMAND\""
# Software versions
echo docker $dockerver
echo borgmatic $borgmaticver
echo $borgver
echo apprise $apprisever
# Start cron
# Generate Cron variables
CRON="${CRON:-"0 1 * * *"}"
CRON_COMMAND="${CRON_COMMAND:-"borgmatic --stats -v 0 2>&1"}"
# Apply cron variables
echo "$CRON $CRON_COMMAND" > /etc/crontabs/root
/usr/sbin/crond -f -L /dev/stdout
if [ -v EXTRA_CRON ]
then
echo "$EXTRA_CRON" >> /etc/crontabs/root
fi
# Output cron settings to console
printf "Cron job set as: \n$crontab\n"
# Start Cron
/usr/sbin/crond -f -L /dev/stdout