2021-01-03 18:15:44 +05:30
|
|
|
FROM golang:1.14-buster AS builder
|
2021-07-14 23:36:27 +05:30
|
|
|
|
|
|
|
|
# Add Maintainer Info
|
|
|
|
|
LABEL maintainer="signoz"
|
|
|
|
|
|
|
|
|
|
ARG TARGETPLATFORM
|
|
|
|
|
|
2021-01-03 18:15:44 +05:30
|
|
|
ENV CGO_ENABLED=0
|
|
|
|
|
ENV GOPATH=/go
|
|
|
|
|
|
2021-07-14 23:36:27 +05:30
|
|
|
RUN export GOOS=$(echo ${TARGETPLATFORM} | cut -d / -f1) && \
|
|
|
|
|
export GOARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2)
|
|
|
|
|
|
2021-01-03 18:15:44 +05:30
|
|
|
# Prepare and enter src directory
|
|
|
|
|
WORKDIR /go/src/github.com/signoz/signoz/pkg/query-service
|
|
|
|
|
|
|
|
|
|
# Cache dependencies
|
|
|
|
|
ADD go.mod .
|
|
|
|
|
ADD go.sum .
|
|
|
|
|
RUN go mod download -x
|
|
|
|
|
|
|
|
|
|
# Add the sources and proceed with build
|
|
|
|
|
ADD . .
|
|
|
|
|
RUN go build -o ./bin/query-service ./main.go
|
|
|
|
|
RUN chmod +x ./bin/query-service
|
|
|
|
|
|
|
|
|
|
# use a minimal alpine image
|
|
|
|
|
FROM alpine:3.7
|
|
|
|
|
# add ca-certificates in case you need them
|
|
|
|
|
RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/*
|
|
|
|
|
# set working directory
|
|
|
|
|
WORKDIR /root
|
|
|
|
|
# copy the binary from builder
|
|
|
|
|
COPY --from=builder /go/src/github.com/signoz/signoz/pkg/query-service/bin/query-service .
|
2021-08-29 10:28:40 +05:30
|
|
|
|
|
|
|
|
COPY config/prometheus.yml /root/config/prometheus.yml
|
|
|
|
|
|
2021-01-03 18:15:44 +05:30
|
|
|
# run the binary
|
2021-08-29 10:28:40 +05:30
|
|
|
ENTRYPOINT ["./query-service"]
|
|
|
|
|
CMD ["-config", "/root/config/prometheus.yml"]
|
|
|
|
|
# CMD ["./query-service -config /root/config/prometheus.yml"]
|
|
|
|
|
EXPOSE 8080
|
2021-01-03 18:15:44 +05:30
|
|
|
|