Skip to content

Commit

Permalink
fix(ci): loki-canary cross platform
Browse files Browse the repository at this point in the history
  • Loading branch information
sh0rez committed Jul 30, 2019
1 parent da8b322 commit 2cebc49
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,8 @@ loki-push:
# loki-canary
loki-canary-image:
$(SUDO) $(BUILD_OCI) -t $(IMAGE_PREFIX)/loki-canary:$(IMAGE_TAG) -f cmd/loki-canary/Dockerfile .
loki-canary-push:
$(SUDO) $(PUSH_OCI) $(IMAGE_PREFIX)/loki-canary:$(IMAGE_TAG)

# build-image (only amd64)
build-image: OCI_PLATFORMS=
Expand Down
15 changes: 9 additions & 6 deletions cmd/loki-canary/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# Directories in this file are referenced from the root of the project not this folder
# This file is intented 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 grafana/loki-build-image:0.2.1 as build
ARG GOARCH="amd64"
FROM --platform=linux/amd64 grafana/loki-build-image as build
COPY --from=goenv /goarch /goarm /
COPY . /go/src/github.com/grafana/loki
WORKDIR /go/src/github.com/grafana/loki
RUN make clean && make loki-canary
RUN GOARCH=$(cat /goarch) GOARM=$(cat /goarm) make clean && make loki-canary

FROM alpine:3.9
RUN apk add --update --no-cache ca-certificates
COPY --from=build /go/src/github.com/grafana/loki/cmd/loki-canary/loki-canary /usr/bin/loki-canary
FROM alpine:3.9
RUN apk add --update --no-cache ca-certificates
COPY --from=build /go/src/github.com/grafana/loki/cmd/loki-canary/loki-canary /usr/bin/loki-canary
ENTRYPOINT [ "/usr/bin/loki-canary" ]

0 comments on commit 2cebc49

Please sign in to comment.