Place docker files in scripts and update makefile
This commit is contained in:
21
scripts/alpine.docker
Normal file
21
scripts/alpine.docker
Normal file
@@ -0,0 +1,21 @@
|
||||
FROM golang:1.11.0 as builder
|
||||
ENV DEP_VERSION 0.5.0
|
||||
RUN curl -fsSL -o /usr/local/bin/dep https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 && chmod +x /usr/local/bin/dep
|
||||
WORKDIR /go/src/github.com/influxdata/telegraf
|
||||
COPY Gopkg.toml Gopkg.lock ./
|
||||
RUN dep ensure -vendor-only
|
||||
COPY . /go/src/github.com/influxdata/telegraf
|
||||
RUN CGO_ENABLED=0 make go-install
|
||||
|
||||
FROM alpine:3.6
|
||||
RUN echo 'hosts: files dns' >> /etc/nsswitch.conf
|
||||
RUN apk add --no-cache iputils ca-certificates net-snmp-tools procps lm_sensors && \
|
||||
update-ca-certificates
|
||||
COPY --from=builder /go/bin/* /usr/bin/
|
||||
COPY etc/telegraf.conf /etc/telegraf/telegraf.conf
|
||||
|
||||
EXPOSE 8125/udp 8092/udp 8094
|
||||
|
||||
COPY scripts/docker-entrypoint.sh /entrypoint.sh
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["telegraf"]
|
||||
@@ -1,8 +0,0 @@
|
||||
FROM debian:stretch
|
||||
ARG package
|
||||
ADD ${package} ${package}
|
||||
RUN dpkg -i ${package}
|
||||
|
||||
EXPOSE 8125/udp 8092/udp 8094
|
||||
|
||||
CMD ["telegraf"]
|
||||
8
scripts/docker-entrypoint.sh
Executable file
8
scripts/docker-entrypoint.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
if [ "${1:0:1}" = '-' ]; then
|
||||
set -- telegraf "$@"
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
18
scripts/stretch.docker
Normal file
18
scripts/stretch.docker
Normal file
@@ -0,0 +1,18 @@
|
||||
FROM golang:1.11.0 as builder
|
||||
ENV DEP_VERSION 0.5.0
|
||||
RUN curl -fsSL -o /usr/local/bin/dep https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 && chmod +x /usr/local/bin/dep
|
||||
WORKDIR /go/src/github.com/influxdata/telegraf
|
||||
COPY Gopkg.toml Gopkg.lock ./
|
||||
RUN dep ensure -vendor-only
|
||||
COPY . /go/src/github.com/influxdata/telegraf
|
||||
RUN make go-install
|
||||
|
||||
FROM buildpack-deps:stretch-curl
|
||||
COPY --from=builder /go/bin/* /usr/bin/
|
||||
COPY etc/telegraf.conf /etc/telegraf/telegraf.conf
|
||||
|
||||
EXPOSE 8125/udp 8092/udp 8094
|
||||
|
||||
COPY scripts/docker-entrypoint.sh /entrypoint.sh
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["telegraf"]
|
||||
Reference in New Issue
Block a user