Skip to content

Commit

Permalink
Added logcli docker image (#2561)
Browse files Browse the repository at this point in the history
Signed-off-by: Tharun <rajendrantharun@live.com>
  • Loading branch information
tharun208 authored Sep 1, 2020
1 parent b8b24f3 commit ab2dc9e
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .drone/drone.jsonnet
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local apps = ['loki', 'loki-canary', 'promtail'];
local apps = ['loki', 'loki-canary', 'promtail','logcli'];
local archs = ['amd64', 'arm64', 'arm'];

local build_image_version = std.extVar('__build-image-version');
Expand Down
120 changes: 120 additions & 0 deletions .drone/drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,27 @@ steps:
depends_on:
- image-tag

- name: build-logcli-image
image: plugins/docker
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: cmd/logcli/Dockerfile
dry_run: true
password:
from_secret: docker_password
repo: grafana/logcli
username:
from_secret: docker_username
when:
ref:
exclude:
- refs/heads/master
- refs/heads/k??
- refs/tags/v*
depends_on:
- image-tag

- name: publish-loki-image
image: plugins/docker
settings:
Expand Down Expand Up @@ -177,6 +198,25 @@ steps:
depends_on:
- image-tag

- name: publish-logcli-image
image: plugins/docker
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: cmd/logcli/Dockerfile
password:
from_secret: docker_password
repo: grafana/logcli
username:
from_secret: docker_username
when:
ref:
- refs/heads/master
- refs/heads/k??
- refs/tags/v*
depends_on:
- image-tag

depends_on:
- check

Expand Down Expand Up @@ -259,6 +299,27 @@ steps:
depends_on:
- image-tag

- name: build-logcli-image
image: plugins/docker
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: cmd/logcli/Dockerfile
dry_run: true
password:
from_secret: docker_password
repo: grafana/logcli
username:
from_secret: docker_username
when:
ref:
exclude:
- refs/heads/master
- refs/heads/k??
- refs/tags/v*
depends_on:
- image-tag

- name: publish-loki-image
image: plugins/docker
settings:
Expand Down Expand Up @@ -316,6 +377,25 @@ steps:
depends_on:
- image-tag

- name: publish-logcli-image
image: plugins/docker
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: cmd/logcli/Dockerfile
password:
from_secret: docker_password
repo: grafana/logcli
username:
from_secret: docker_username
when:
ref:
- refs/heads/master
- refs/heads/k??
- refs/tags/v*
depends_on:
- image-tag

depends_on:
- check

Expand Down Expand Up @@ -398,6 +478,27 @@ steps:
depends_on:
- image-tag

- name: build-logcli-image
image: plugins/docker
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: cmd/logcli/Dockerfile
dry_run: true
password:
from_secret: docker_password
repo: grafana/logcli
username:
from_secret: docker_username
when:
ref:
exclude:
- refs/heads/master
- refs/heads/k??
- refs/tags/v*
depends_on:
- image-tag

- name: publish-loki-image
image: plugins/docker
settings:
Expand Down Expand Up @@ -455,6 +556,25 @@ steps:
depends_on:
- image-tag

- name: publish-logcli-image
image: plugins/docker
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: cmd/logcli/Dockerfile
password:
from_secret: docker_password
repo: grafana/logcli
username:
from_secret: docker_username
when:
ref:
- refs/heads/master
- refs/heads/k??
- refs/tags/v*
depends_on:
- image-tag

depends_on:
- check

Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ touch-protobuf-sources:

logcli: yacc cmd/logcli/logcli

logcli-image:
$(SUDO) docker build -t $(IMAGE_PREFIX)/logcli:$(IMAGE_TAG) -f cmd/logcli/Dockerfile .

cmd/logcli/logcli: $(APP_GO_FILES) cmd/logcli/main.go
CGO_ENABLED=0 go build $(GO_FLAGS) -o $@ ./$(@D)
$(NETGO_CHECK)
Expand Down
13 changes: 13 additions & 0 deletions cmd/logcli/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM golang:1.14.2 as build

COPY . /src/loki
WORKDIR /src/loki
RUN make clean && make BUILD_IN_CONTAINER=false logcli

FROM alpine:3.9

RUN apk add --no-cache ca-certificates

COPY --from=build /src/loki/cmd/logcli/logcli /usr/bin/logcli

ENTRYPOINT [ "/usr/bin/logcli" ]

0 comments on commit ab2dc9e

Please sign in to comment.