From 7e78f79b18530d34481da2cc942e275b74d110ad Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Thu, 17 Oct 2019 10:52:02 -0400 Subject: [docker] Switch to using chaperone for init This will allow us to setup a cronjob that will once per night download the geoipdb update. --- Dockerfile | 10 +++++----- chaperone.d/download-geoipdb.conf | 5 +++++ chaperone.d/getmyip.conf | 5 +++++ 3 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 chaperone.d/download-geoipdb.conf create mode 100644 chaperone.d/getmyip.conf diff --git a/Dockerfile b/Dockerfile index 582b214..7395e9e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:stable AS build +FROM debian:stretch AS build RUN apt-get -q update && env DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ build-essential pkg-config golang-go git ca-certificates \ && rm -rf /var/lib/apt/lists/* @@ -9,14 +9,14 @@ WORKDIR $GOPATH RUN go get 0xacab.org/leap/getmyip RUN strip $GOPATH/bin/getmyip -FROM debian:stable -RUN echo 'deb http://deb.debian.org/debian buster contrib' > /etc/apt/sources.list.d/contrib.list +FROM registry.git.autistici.org/ai3/docker/chaperone-base +RUN echo 'deb http://deb.debian.org/debian stretch contrib' > /etc/apt/sources.list.d/contrib.list RUN apt-get -q update && env DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ geoipupdate ca-certificates \ && rm -rf /var/lib/apt/lists/* - RUN cp /usr/share/doc/geoipupdate/examples/GeoIP.conf.default /etc/GeoIP.conf RUN /usr/bin/geoipupdate COPY --from=build /go/bin/getmyip /usr/local/bin/getmyip +COPY chaperone.d/ /etc/chaperone.d -ENTRYPOINT ["/usr/local/bin/getmyip", "-notls"] +ENTRYPOINT ["/usr/local/bin/chaperone"] diff --git a/chaperone.d/download-geoipdb.conf b/chaperone.d/download-geoipdb.conf new file mode 100644 index 0000000..4c4df07 --- /dev/null +++ b/chaperone.d/download-geoipdb.conf @@ -0,0 +1,5 @@ +download-geoipdb-cron.service: { + type: cron, + interval: "59 23 * * *", + command: "/usr/bin/geoipupdate" +} diff --git a/chaperone.d/getmyip.conf b/chaperone.d/getmyip.conf new file mode 100644 index 0000000..4b24a39 --- /dev/null +++ b/chaperone.d/getmyip.conf @@ -0,0 +1,5 @@ +getmyip.service: { + type: forking, + command: "/usr/local/bin/getmyip -notls", + exit_kills: true +} -- cgit v1.2.3