From 16634e9734078fb1330c2001fc572fcd441e6793 Mon Sep 17 00:00:00 2001 From: Andrei Burd Date: Mon, 15 Feb 2016 11:29:31 +0200 Subject: [PATCH] make target to build docker image --- .dockerignore | 1 + Dockerfile | 10 ++++++++++ Makefile | 6 ++++++ 3 files changed, 17 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..6b8710a71 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +.git diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..a0a9eb9ee --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM alpine + +MAINTAINER ops@yotpo.com + +RUN mkdir -p /etc/telegraf/telegraf.d/ + +COPY telegraf /usr/bin/ +COPY telegraf.conf /etc/telegraf/ + +CMD [ "/usr/bin/telegraf", "-config", "/etc/telegraf/telegraf.conf", "-config-directory", "/etc/telegraf/telegraf.d"] diff --git a/Makefile b/Makefile index 2efad7705..2c0dff0ec 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,12 @@ build-for-docker: "-X main.Version=$(VERSION)" \ ./cmd/telegraf/telegraf.go +build-docker: build-for-docker + ./telegraf -sample-config -input-filter cpu:mem -output-filter influxdb \ + | sed -e "s/localhost:8086/influxdb:8086/g" > telegraf.conf + docker build -t influxdata/telegraf:$(VERSION) . + rm telegraf.conf + # Build with race detector dev: prepare go build -race -o telegraf -ldflags \