Skip to content

Commit d7c7d4c

Browse files
committed
Add support to run in docker container for systems without php
1 parent a8a6327 commit d7c7d4c

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

Dockerfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM php:8.2-cli-alpine
2+
COPY . /
3+
WORKDIR /
4+
5+
ENV SCHEDULE="*/5 * * * *" \
6+
CRON_CMD="php /update.php"
7+
8+
ENTRYPOINT ["/entrypoint.sh"]
9+
10+
CMD ["/usr/sbin/crond", "-f"]
11+
12+
SHELL ["/bin/ash"]

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ Configuration is very simple:
5050

5151
You should probably run this script every few minutes, so that your IP is updated as quickly as possible. Add it to your cronjobs and run it regularly, for example every five minutes.
5252

53+
### How to use - alternative with Docker
54+
`docker compose up`
55+
56+
The docker container includes the cronjob and runs by default every 5 minutes.
57+
5358
### CLI options
5459
Just add these Options after the command like `./update.php --quiet`
5560

docker-compose.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: '3'
2+
3+
services:
4+
netcup-dyndns:
5+
network_mode: host
6+
environment:
7+
- SCHEDULE="*/5 * * * *"
8+
build:
9+
context: .
10+
dockerfile: Dockerfile

entrypoint.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/ash -e
2+
3+
echo "startup $0"
4+
5+
if [ ! -z "${SCHEDULE}" ] && [ ! -z "${CRON_CMD}" ]; then
6+
echo "configure cron: ${SCHEDULE} ${CRON_CMD}"
7+
echo "@reboot ${CRON_CMD}" > /etc/crontabs/root
8+
echo "${SCHEDULE} ${CRON_CMD}" >> /etc/crontabs/root
9+
fi
10+
11+
echo "run: $@"
12+
exec "$@"
13+

0 commit comments

Comments
 (0)