Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for building querytee #2602

Merged
merged 1 commit into from
Sep 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,14 @@ cmd/loki-canary/loki-canary: $(APP_GO_FILES) cmd/loki-canary/main.go
CGO_ENABLED=0 go build $(GO_FLAGS) -o $@ ./$(@D)
$(NETGO_CHECK)

#################
# Loki-QueryTee #
#################

loki-querytee: $(APP_GO_FILES) cmd/querytee/main.go
CGO_ENABLED=0 go build $(GO_FLAGS) -o ./cmd/querytee/$@ ./cmd/querytee/
$(NETGO_CHECK)

############
# Promtail #
############
Expand Down Expand Up @@ -260,6 +268,7 @@ clean:
rm -rf cmd/loki/loki
rm -rf cmd/logcli/logcli
rm -rf cmd/loki-canary/loki-canary
rm -rf cmd/querytee/querytee
rm -rf .cache
rm -rf cmd/docker-driver/rootfs
rm -rf dist/
Expand Down Expand Up @@ -535,6 +544,14 @@ loki-canary-image-cross:
loki-canary-push: loki-canary-image-cross
$(SUDO) $(PUSH_OCI) $(IMAGE_PREFIX)/loki-canary:$(IMAGE_TAG)

# loki-querytee
loki-querytee-image:
$(SUDO) docker build -t $(IMAGE_PREFIX)/loki-querytee:$(IMAGE_TAG) -f cmd/querytee/Dockerfile .
loki-querytee-image-cross:
$(SUDO) $(BUILD_OCI) -t $(IMAGE_PREFIX)/loki-querytee:$(IMAGE_TAG) -f cmd/querytee/Dockerfile.cross .
loki-querytee-push: loki-querytee-image-cross
$(SUDO) $(PUSH_OCI) $(IMAGE_PREFIX)/loki-querytee:$(IMAGE_TAG)

# build-image (only amd64)
build-image: OCI_PLATFORMS=
build-image:
Expand Down
11 changes: 11 additions & 0 deletions cmd/querytee/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM golang:1.14.2 as build

ARG TOUCH_PROTOS
COPY . /src/loki
WORKDIR /src/loki
RUN make clean && make BUILD_IN_CONTAINER=false loki-querytee

FROM alpine:3.9
RUN apk add --update --no-cache ca-certificates
COPY --from=build /src/loki/cmd/querytee/loki-querytee /usr/bin/querytee
ENTRYPOINT [ "/usr/bin/querytee" ]
18 changes: 18 additions & 0 deletions cmd/querytee/Dockerfile.cross
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
ARG BUILD_IMAGE=grafana/loki-build-image:0.9.1
# Directories in this file are referenced from the root of the project not this folder
# This file is intended to be called from the root like so:
# docker build -t grafana/promtail -f cmd/promtail/Dockerfile .
FROM golang:1.11.4-alpine as goenv
RUN go env GOARCH > /goarch && \
go env GOARM > /goarm

FROM --platform=linux/amd64 $BUILD_IMAGE as build
COPY --from=goenv /goarch /goarm /
COPY . /src/loki
WORKDIR /src/loki
RUN make clean && GOARCH=$(cat /goarch) GOARM=$(cat /goarm) make BUILD_IN_CONTAINER=false loki-querytee

FROM alpine:3.9
RUN apk add --update --no-cache ca-certificates
COPY --from=build /src/loki/cmd/querytee/querytee /usr/bin/querytee
ENTRYPOINT [ "/usr/bin/querytee" ]