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

TOUCH_PROTOS build arg for dockerfile #1479

Merged
merged 4 commits into from
Jan 8, 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
12 changes: 12 additions & 0 deletions .drone/drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ steps:
image: plugins/docker
settings:
dockerfile: cmd/loki/Dockerfile
build_args:
- TOUCH_PROTOS=1
dry_run: true
password:
from_secret: docker_password
Expand All @@ -200,6 +202,8 @@ steps:
image: plugins/docker
settings:
dockerfile: cmd/loki-canary/Dockerfile
build_args:
- TOUCH_PROTOS=1
dry_run: true
password:
from_secret: docker_password
Expand All @@ -218,6 +222,8 @@ steps:
image: plugins/docker
settings:
dockerfile: cmd/promtail/Dockerfile
build_args:
- TOUCH_PROTOS=1
dry_run: true
password:
from_secret: docker_password
Expand All @@ -236,6 +242,8 @@ steps:
image: plugins/docker
settings:
dockerfile: cmd/loki/Dockerfile
build_args:
- TOUCH_PROTOS=1
password:
from_secret: docker_password
repo: grafana/loki
Expand All @@ -252,6 +260,8 @@ steps:
image: plugins/docker
settings:
dockerfile: cmd/loki-canary/Dockerfile
build_args:
- TOUCH_PROTOS=1
password:
from_secret: docker_password
repo: grafana/loki-canary
Expand All @@ -268,6 +278,8 @@ steps:
image: plugins/docker
settings:
dockerfile: cmd/promtail/Dockerfile
build_args:
- TOUCH_PROTOS=1
password:
from_secret: docker_password
repo: grafana/promtail
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ endif

protos: $(PROTO_GOS)

# use with care. This signals to make that the proto definitions don't need recompiling.
touch-protos:
for proto in $(PROTO_GOS); do [ -f "./$${proto}" ] && touch "$${proto}" && echo "touched $${proto}"; done

Expand Down
5 changes: 4 additions & 1 deletion cmd/loki-canary/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
FROM golang:1.13 as build
# TOUCH_PROTOS signifies if we should touch the compiled proto files and thus not regenerate them.
# This is helpful when file system timestamps can't be trusted with make
ARG TOUCH_PROTOS
COPY . /src/loki
WORKDIR /src/loki
RUN make clean && make BUILD_IN_CONTAINER=false loki-canary
RUN make clean && (if [ "${TOUCH_PROTOS}" ]; then make touch-protos; fi) && make BUILD_IN_CONTAINER=false loki-canary

FROM alpine:3.9
RUN apk add --update --no-cache ca-certificates
Expand Down
5 changes: 4 additions & 1 deletion cmd/loki/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
FROM golang:1.13 as build
# TOUCH_PROTOS signifies if we should touch the compiled proto files and thus not regenerate them.
# This is helpful when file system timestamps can't be trusted with make
ARG TOUCH_PROTOS
COPY . /src/loki
WORKDIR /src/loki
RUN make clean && make BUILD_IN_CONTAINER=false loki
RUN make clean && (if [ "${TOUCH_PROTOS}" ]; then make touch-protos; fi) && make BUILD_IN_CONTAINER=false loki

FROM alpine:3.9
RUN apk add --update --no-cache ca-certificates
Expand Down
5 changes: 4 additions & 1 deletion cmd/promtail/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
FROM golang:1.13 as build
# TOUCH_PROTOS signifies if we should touch the compiled proto files and thus not regenerate them.
# This is helpful when file system timestamps can't be trusted with make
ARG TOUCH_PROTOS
COPY . /src/loki
WORKDIR /src/loki
RUN apt-get update && apt-get install -qy libsystemd-dev
RUN make clean && make BUILD_IN_CONTAINER=false promtail
RUN make clean && (if [ "${TOUCH_PROTOS}" ]; then make touch-protos; fi) && make BUILD_IN_CONTAINER=false promtail

# Promtail requires debian as the base image to support systemd journal reading
FROM debian:stretch-slim
Expand Down