From 8410fa3b649b5c0d3e16518f40835c3b44e28863 Mon Sep 17 00:00:00 2001 From: Thomas Klaehn Date: Sun, 13 Nov 2022 07:20:12 +0100 Subject: [PATCH] Initial commit --- Dockerfile | 24 ++++++++++++++++++++++++ config.json | 7 +++++++ run.sh | 11 +++++++++++ start.sh | 12 ++++++++++++ 4 files changed, 54 insertions(+) create mode 100644 Dockerfile create mode 100644 config.json create mode 100755 run.sh create mode 100755 start.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1e71238 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM golang:alpine AS builder + +WORKDIR /build + +RUN apk add --update --no-cache git make + +RUN git clone https://git.blackfinn.de/go/activitycollect.git && \ + cd activitycollect && \ + make all + + +FROM alpine:latest + +RUN mkdir -p /usr/bin +COPY --from=builder /build/activitycollect/bin/activitycollect /usr/bin + +RUN mkdir -p /activitycollect/infolder +RUN mkdir -p /activitycollect/outfolder + +COPY config.json /activitycollect/ +COPY run.sh /usr/bin/ + +ENTRYPOINT ["/usr/bin/run.sh"] + diff --git a/config.json b/config.json new file mode 100644 index 0000000..16fb39c --- /dev/null +++ b/config.json @@ -0,0 +1,7 @@ +{ + "in_folder": "/acticitycollect/infolder", + "out_folder": "/activitycollect/outfolder", + "influxdb_host": "barsch.local", + "influxdb_port": 8086, + "influxdb_token": "" +} diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..5f8986a --- /dev/null +++ b/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +if [ ! -f /etc/activitycollect/config.json ]; +then + echo "config not fount - installing default config file"; + mkdir -p /etc/activitycollect + cp /activitycollect/config.json /etc/activitycollect/config.json +fi + +/usr/bin/activitycollect -c /etc/activitycollect/config.json + diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..1a47209 --- /dev/null +++ b/start.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +docker run \ + -d \ + --volume "/srv/activitycollect/config:/etc/activitycollect" \ + --volume "/srv/dropbox/Apps/WahooFitness:/activitycollect/infolder/" \ + --volume "/srv/activitycollect/data/processed:/activitycollect/outfolder/" \ + --name activitycollect \ + --rm \ + --restart unless-stopped \ + activitycollect +