diff --git a/examples/docker.yml b/examples/docker.yml index a00f18889..636bc03b7 100644 --- a/examples/docker.yml +++ b/examples/docker.yml @@ -56,6 +56,15 @@ services: - CAP_NET_RAW net: host oomScoreAdj: -800 + - name: ntpd + image: "mobylinux/openntpd:a570316d7fc49ca1daa29bd945499f4963d227af" + capabilities: + - CAP_SYS_TIME + - CAP_SYS_NICE + - CAP_SYS_CHROOT + - CAP_SETUID + - CAP_SETGID + net: host - name: docker image: "mobylinux/docker-ce:741bf21513328f674e0cdcaa55492b0b75974e08" capabilities: diff --git a/pkg/openntpd/Dockerfile b/pkg/openntpd/Dockerfile new file mode 100644 index 000000000..53eeeaf65 --- /dev/null +++ b/pkg/openntpd/Dockerfile @@ -0,0 +1,11 @@ +FROM alpine:3.5 + +RUN \ + apk update && apk upgrade -a && \ + apk add --no-cache \ + openntpd \ + && true + +COPY . . + +CMD ["/usr/sbin/ntpd", "-d", "-s"] diff --git a/pkg/openntpd/Makefile b/pkg/openntpd/Makefile new file mode 100644 index 000000000..cca4a3841 --- /dev/null +++ b/pkg/openntpd/Makefile @@ -0,0 +1,29 @@ +.PHONY: tag push clean container +default: push + +IMAGE=openntpd + +BASE=alpine:3.5 + +hash: Dockerfile etc/ntpd.conf + DOCKER_CONTENT_TRUST=1 docker pull $(BASE) + tar cf - $^ | docker build --no-cache -t $(IMAGE):build - + docker run --rm $(IMAGE):build sh -c 'cat $^ /lib/apk/db/installed | sha1sum' | sed 's/ .*//' > hash + +push: hash + docker pull mobylinux/$(IMAGE):$(shell cat hash) || \ + (docker tag $(IMAGE):build mobylinux/$(IMAGE):$(shell cat hash) && \ + docker push mobylinux/$(IMAGE):$(shell cat hash)) + docker rmi $(IMAGE):build + rm -f hash + +tag: hash + docker pull mobylinux/$(IMAGE):$(shell cat hash) || \ + docker tag $(IMAGE):build mobylinux/$(IMAGE):$(shell cat hash) + docker rmi $(IMAGE):build + rm -f hash + +clean: + rm -rf hash + +.DELETE_ON_ERROR: diff --git a/pkg/openntpd/etc/ntpd.conf b/pkg/openntpd/etc/ntpd.conf new file mode 100644 index 000000000..980d8a912 --- /dev/null +++ b/pkg/openntpd/etc/ntpd.conf @@ -0,0 +1,21 @@ +# $OpenBSD: ntpd.conf,v 1.3 2015/05/18 11:10:03 dtucker Exp $ +# sample ntpd configuration file, see ntpd.conf(5) + +# Addresses to listen on (ntpd does not listen by default) +#listen on * + +# sync to a single server +#server ntp.example.org + +# use a random selection of NTP Pool Time Servers +# see http://support.ntp.org/bin/view/Servers/NTPPoolServers +servers pool.ntp.org + +# use a specific local timedelta sensor (radio clock, etc) +#sensor nmea0 + +# use all detected timedelta sensors +#sensor * + +# get the time constraint from a well-known HTTPS site +# constraints from "https://www.google.com/"