mirror of
https://github.com/mag37/dockcheck.git
synced 2026-03-05 00:20:30 +01:00
Docker configuration
This commit is contained in:
parent
fc0b1a2505
commit
0d2d1b90c8
4 changed files with 71 additions and 1 deletions
7
.gitignore
vendored
7
.gitignore
vendored
|
|
@ -8,4 +8,9 @@ regctl
|
||||||
# ignore snooze file
|
# ignore snooze file
|
||||||
snooze.list
|
snooze.list
|
||||||
# ignore updates file
|
# ignore updates file
|
||||||
updates_available.txt
|
updates_available.txt
|
||||||
|
# ignore user compose files
|
||||||
|
compose.yaml
|
||||||
|
compose.yml
|
||||||
|
docker-compose.yaml
|
||||||
|
docker-compose.yml
|
||||||
|
|
|
||||||
25
Dockerfile
Normal file
25
Dockerfile
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
# 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 /usr/local/bin/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 ln -s /app/dockcheck.sh /usr/local/bin/dockcheck.sh
|
||||||
|
RUN chmod +x /usr/local/bin/dockcheck.sh
|
||||||
|
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||||
|
|
||||||
|
# Run the cron daemon in the foreground and tail the log file to keep the container running
|
||||||
|
CMD ["supercronic", "/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
|
||||||
26
entrypoint.sh
Normal file
26
entrypoint.sh
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
#!/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
|
||||||
|
|
||||||
|
# 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
|
||||||
|
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