summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2019-10-17 10:52:02 -0400
committerMicah Anderson <micah@riseup.net>2019-10-17 10:52:02 -0400
commit7e78f79b18530d34481da2cc942e275b74d110ad (patch)
treef54cea5f181225032133f634f7297e6674fcabad
parenta11da39e1fb9c4d6d336d83aae6a58238d8a4a98 (diff)
[docker] Switch to using chaperone for init
This will allow us to setup a cronjob that will once per night download the geoipdb update.
-rw-r--r--Dockerfile10
-rw-r--r--chaperone.d/download-geoipdb.conf5
-rw-r--r--chaperone.d/getmyip.conf5
3 files changed, 15 insertions, 5 deletions
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
+}