mirror of
https://github.com/mag37/dockcheck.git
synced 2026-02-14 23:38:15 +01:00
Merge 867b14d409 into 7785e869d3
This commit is contained in:
commit
0a24211e6e
4 changed files with 81 additions and 1 deletions
7
.gitignore
vendored
7
.gitignore
vendored
|
|
@ -8,4 +8,9 @@ regctl
|
|||
# ignore snooze file
|
||||
snooze.list
|
||||
# ignore updates file
|
||||
updates_available.txt
|
||||
updates_available.txt
|
||||
# ignore user compose files
|
||||
compose.yaml
|
||||
compose.yml
|
||||
docker-compose.yaml
|
||||
docker-compose.yml
|
||||
|
|
|
|||
24
Dockerfile
Normal file
24
Dockerfile
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# Use an official Alpine image as a base
|
||||
FROM alpine:latest
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install apps
|
||||
RUN apk update && apk add --no-cache bash curl docker-cli docker-cli-compose supercronic jq regclient msmtp --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/
|
||||
|
||||
# Copy the script files into the container
|
||||
COPY entrypoint.sh /app/entrypoint.sh
|
||||
COPY dockcheck.sh /app/dockcheck.sh
|
||||
COPY urls.list /app/urls.list
|
||||
COPY notify_templates /app/notify_templates
|
||||
COPY extras /app/extras
|
||||
COPY addons /app/addons
|
||||
|
||||
# Create symlink, give execution rights on the script and set proper permissions
|
||||
RUN chmod +x /app/dockcheck.sh
|
||||
RUN chmod +x /app/entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||
|
||||
# Run the cron daemon in the foreground and tail the log file to keep the container running
|
||||
CMD ["supercronic", "-passthrough-logs", "-json", "/app/crontab"]
|
||||
14
compose-example.yaml
Normal file
14
compose-example.yaml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
services:
|
||||
dockcheck:
|
||||
image: dockcheck:latest
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
CRON_SCHEDULE: "0 * * * *"
|
||||
DOCKCHECK_ARGS: "-mniI -x 10"
|
||||
CRON_SCHEDULE_1: "30 1 * * *"
|
||||
DOCKCHECK_ARGS_1: "-milap -x 1"
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- ./dockcheck.config:/app/dockcheck.config
|
||||
- /path/to/projects/docker:/path/to/projects/docker:ro
|
||||
37
entrypoint.sh
Normal file
37
entrypoint.sh
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Exit immediately if a command exits with a non-zero status
|
||||
set -e
|
||||
|
||||
# If the CRON_SCHEDULE and DOCKCHECK_ARGS environment variables are set, create the crontab entry for the dockcheck user
|
||||
if [ -n "$CRON_SCHEDULE" ] && [ -n "$DOCKCHECK_ARGS" ]; then
|
||||
# Write the environment variable content to a temporary file, ensuring a newline at the end
|
||||
echo "$CRON_SCHEDULE" /app/dockcheck.sh $DOCKCHECK_ARGS > /app/crontab
|
||||
|
||||
if [ -n "$DOCKCHECK_ONSTART" ]; then
|
||||
echo "Executing: dockcheck $DOCKCHECK_ARGS"
|
||||
/app/dockcheck.sh $DOCKCHECK_ARGS
|
||||
fi
|
||||
|
||||
# Support additional schedule variables
|
||||
for schedule_var in "${!CRON_SCHEDULE_@}"; do
|
||||
suffix="${schedule_var#CRON_SCHEDULE_}"
|
||||
schedule_value="${!schedule_var}"
|
||||
args_var="DOCKCHECK_ARGS_${suffix}"
|
||||
args_value="${!args_var}"
|
||||
echo "$schedule_value" /app/dockcheck.sh $args_value >> /app/crontab
|
||||
|
||||
onstart_var="DOCKCHECK_ONSTART_${suffix}"
|
||||
if [ -n "${!onstart_var}" ]; then
|
||||
echo "Executing: dockcheck $args_value"
|
||||
/app/dockcheck.sh $args_value
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Crontab created."
|
||||
else
|
||||
echo "No CRON_SCHEDULE or DOCKCHECK_ARGS environment variable(s) found. No crontab created."
|
||||
fi
|
||||
|
||||
# Pass control to the CMD command specified in the Dockerfile
|
||||
exec "$@"
|
||||
Loading…
Add table
Add a link
Reference in a new issue