Prometheus Kafka Writer Microservice
[demo.git] / vnfs / DAaaS / microservices / prom-kafka-writer / Dockerfile.ci
1 # Use base golang image from Docker Hub
2 FROM golang:1.12.7 as builder
3
4 # Download the dlv (delve) debugger for go (you can comment this out if unused)
5 RUN go get -u -v github.com/go-delve/delve/cmd/dlv
6
7 WORKDIR /src/prom-kafka-writer
8
9 RUN mkdir /librdkafka-dir && cd /librdkafka-dir
10 RUN git clone https://github.com/edenhill/librdkafka.git && \ 
11 cd librdkafka && \
12 ./configure --prefix /usr && \
13 make && \
14 make install
15
16 # Install dependencies in go.mod and go.sum
17 COPY go.mod go.sum ./
18 RUN go mod download
19
20 # Copy rest of the application source code
21 COPY . ./
22
23 # Compile the application to /app.
24 RUN go build -o ./bin/prom-kafka-writer -v ./cmd/prom-kafka-writer
25
26 # If you want to use the debugger, you need to modify the entrypoint to the
27 # container and point it to the "dlv debug" command:
28 #   * UNCOMMENT the following ENTRYPOINT statement,
29 #   * COMMENT OUT the last ENTRYPOINT statement
30 # Start the "dlv debug" server on port 3000 of the container.
31 #ENTRYPOINT ["dlv", "exec", "./bin/prom-kafka-writer", "--continue", "--accept-multiclient", "--api-version=2", "--headless", "--listen=:3000", "--log"]
32
33 # If you want to run WITHOUT the debugging server:
34 #   * COMMENT OUT the previous ENTRYPOINT statements,
35 #   * UNCOMMENT the following ENTRYPOINT statement.
36
37 # final stage
38 FROM ubuntu:18.04
39 COPY --from=builder /usr/lib/pkgconfig /usr/lib/pkgconfig
40 COPY --from=builder /usr/lib/librdkafka* /usr/lib/
41 COPY --from=builder //src/prom-kafka-writer/* /prom-kafka-writer/
42 WORKDIR /prom-kafka-writer
43 ENTRYPOINT ["./bin/prom-kafka-writer"]