The images in influxdata-docker are meant to be built by downloading official releases. Sometimes, it is useful to build directly from source when you need an unofficial release. These images are meant to be used then using multi-stage builds so that it can build from source and then copy the results to images that match the official counterpart.
19 lines
621 B
Docker
19 lines
621 B
Docker
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 go install ./cmd/...
|
|
|
|
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 docker/entrypoint.sh /entrypoint.sh
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
CMD ["telegraf"]
|