From 61a42cca1b55fdc7b2a339a09f764b19ead90cd5 Mon Sep 17 00:00:00 2001 From: aexel90 Date: Tue, 18 Oct 2022 21:29:35 +0200 Subject: [PATCH] docker files --- .env | 3 +++ Dockerfile.multistage | 14 ++++++++++++++ docker-compose.yml | 19 +++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 .env create mode 100644 Dockerfile.multistage create mode 100644 docker-compose.yml diff --git a/.env b/.env new file mode 100644 index 0000000..84573b5 --- /dev/null +++ b/.env @@ -0,0 +1,3 @@ +USERNAME=***** +HUE_URL=192.168.178.34 +METRICS_FILE=****** \ No newline at end of file diff --git a/Dockerfile.multistage b/Dockerfile.multistage new file mode 100644 index 0000000..73d814d --- /dev/null +++ b/Dockerfile.multistage @@ -0,0 +1,14 @@ +FROM golang:alpine AS build +WORKDIR /app +COPY go.mod ./ +COPY go.sum ./ +RUN go mod download +COPY . . +RUN go build -o /hue_exporter + +FROM alpine:latest +WORKDIR / +COPY --from=build /hue_exporter /hue_exporter +EXPOSE 9773 + +ENTRYPOINT [ "sh", "-c", "/hue_exporter -username ${USERNAME} -hue-url ${HUE_URL} -metrics-file ${METRICS_FILE} " ] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a7c8315 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,19 @@ +version: '3.4' + +services: + stravakomootsync: + image: hue_exporter + build: + context: . + dockerfile: ./Dockerfile.multistage + restart: unless-stopped + container_name: hue_exporter + ports: + - 9773:9773 + env_file: + - .env + logging: + driver: "json-file" + options: + max-file: "3" + max-size: 10m