[docker] Switch to using chaperone for init
authorMicah Anderson <micah@riseup.net>
Thu, 17 Oct 2019 14:52:02 +0000 (10:52 -0400)
committerMicah Anderson <micah@riseup.net>
Thu, 17 Oct 2019 14:52:02 +0000 (10:52 -0400)
This will allow us to setup a cronjob that will once per night download the
geoipdb update.

Dockerfile
chaperone.d/download-geoipdb.conf [new file with mode: 0644]
chaperone.d/getmyip.conf [new file with mode: 0644]

index 582b214..7395e9e 100644 (file)
@@ -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 (file)
index 0000000..4c4df07
--- /dev/null
@@ -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 (file)
index 0000000..4b24a39
--- /dev/null
@@ -0,0 +1,5 @@
+getmyip.service: {
+     type: forking,
+     command: "/usr/local/bin/getmyip -notls",
+     exit_kills: true
+}