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

Update build image with missing deps and a fix or two #1364

Merged
merged 1 commit into from
Dec 4, 2019
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ workflows:
# https://circleci.com/blog/circleci-hacks-reuse-yaml-in-your-circleci-config-with-yaml/
.defaults: &defaults
docker:
- image: grafana/loki-build-image:0.8.0
- image: grafana/loki-build-image:0.9.0
working_directory: /src/loki

jobs:
Expand Down
10 changes: 5 additions & 5 deletions .drone/drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,28 @@ workspace:

steps:
- name: test
image: grafana/loki-build-image:0.8.0
image: grafana/loki-build-image:0.9.0
commands:
- make BUILD_IN_CONTAINER=false test
depends_on:
- clone

- name: lint
image: grafana/loki-build-image:0.8.0
image: grafana/loki-build-image:0.9.0
commands:
- make BUILD_IN_CONTAINER=false lint
depends_on:
- clone

- name: check-generated-files
image: grafana/loki-build-image:0.8.0
image: grafana/loki-build-image:0.9.0
commands:
- make BUILD_IN_CONTAINER=false check-generated-files
depends_on:
- clone

- name: check-mod
image: grafana/loki-build-image:0.8.0
image: grafana/loki-build-image:0.9.0
commands:
- make BUILD_IN_CONTAINER=false check-mod
depends_on:
Expand Down Expand Up @@ -526,7 +526,7 @@ platform:

steps:
- name: trigger
image: grafana/loki-build-image:0.8.0
image: grafana/loki-build-image:0.9.0
commands:
- ./tools/deploy.sh
environment:
Expand Down
17 changes: 16 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ IMAGE_NAMES := $(foreach dir,$(DOCKER_IMAGE_DIRS),$(patsubst %,$(IMAGE_PREFIX)%,
# make BUILD_IN_CONTAINER=false target
# or you can override this with an environment variable
BUILD_IN_CONTAINER ?= true
BUILD_IMAGE_VERSION := 0.8.0
BUILD_IMAGE_VERSION := 0.9.0

# Docker image info
IMAGE_PREFIX ?= grafana
Expand Down Expand Up @@ -491,6 +491,10 @@ build-image: OCI_PLATFORMS=
build-image:
$(SUDO) $(BUILD_OCI) -t $(IMAGE_PREFIX)/loki-build-image:$(IMAGE_TAG) ./loki-build-image
build-image-push: build-image
ifneq (,$(findstring WIP,$(IMAGE_TAG)))
rfratto marked this conversation as resolved.
Show resolved Hide resolved
@echo "Cannot push a WIP image, commit changes first"; \
false;
endif
$(call push,loki-build-image,$(BUILD_IMAGE_VERSION))
$(call push,loki-build-image,latest)

Expand All @@ -505,7 +509,18 @@ benchmark-store:

# regenerate drone yaml
drone:
ifeq ($(BUILD_IN_CONTAINER),true)
@mkdir -p $(shell pwd)/.pkg
@mkdir -p $(shell pwd)/.cache
$(SUDO) docker run $(RM) $(TTY) -i \
-v $(shell pwd)/.cache:/go/cache \
-v $(shell pwd)/.pkg:/go/pkg \
-v $(shell pwd):/src/loki \
$(IMAGE_PREFIX)/loki-build-image:$(BUILD_IMAGE_VERSION) $@;
else
drone jsonnet --stream --format -V __build-image-version=$(BUILD_IMAGE_VERSION) --source .drone/drone.jsonnet --target .drone/drone.yml
endif


# support go modules
check-mod:
Expand Down
2 changes: 1 addition & 1 deletion cmd/docker-driver/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BUILD_IMAGE=grafana/loki-build-image:0.8.0
ARG BUILD_IMAGE=grafana/loki-build-image:0.9.0
# 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/loki -f cmd/loki/Dockerfile .
Expand Down
2 changes: 1 addition & 1 deletion cmd/loki-canary/Dockerfile.cross
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BUILD_IMAGE=grafana/loki-build-image:0.8.0
ARG BUILD_IMAGE=grafana/loki-build-image:0.9.0
# 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 .
Expand Down
2 changes: 1 addition & 1 deletion cmd/loki/Dockerfile.cross
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BUILD_IMAGE=grafana/loki-build-image:0.8.0
ARG BUILD_IMAGE=grafana/loki-build-image:0.9.0
# 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/loki -f cmd/loki/Dockerfile .
Expand Down
2 changes: 1 addition & 1 deletion cmd/promtail/Dockerfile.cross
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BUILD_IMAGE=grafana/loki-build-image:0.8.0
ARG BUILD_IMAGE=grafana/loki-build-image:0.9.0
# 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 .
Expand Down
5 changes: 5 additions & 0 deletions docs/maintaining/release-loki-build-image.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@ The [`loki-build-image`](../../loki-build-image/) is the Docker image used to ru
## How To Perform a Release

1. Update `BUILD_IMAGE_VERSION` in the `Makefile`
1. Update the image version in all the other places it exists
1. Dockerfiles in `cmd` directory
1. .circlie/config.yml
1. Run `make drone` to rebuild the drone yml file with the new image version (the image version in the Makefile is used)
1. Commit your changes (else you will get a WIP tag)
2. Run `make build-image-push`
18 changes: 14 additions & 4 deletions loki-build-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,32 @@ RUN apk add --no-cache curl && \
FROM alpine:edge as docker
RUN apk add --no-cache docker-cli

# TODO this should be fixed to download and extract the specific release binary from github as we do for golangci and helm above
# however we need a commit which hasn't been released yet: https://github.com/drone/drone-cli/commit/1fad337d74ca0ecf420993d9d2d7229a1c99f054
# Read the comment below regarding GO111MODULE=on and why it is necessary
FROM golang:1.13.4 as drone
RUN GO111MODULE=on go get github.com/drone/drone-cli/drone@1fad337d74ca0ecf420993d9d2d7229a1c99f054

FROM golang:1.13.4-stretch
RUN apt-get update && \
apt-get install -qy \
musl \
file unzip jq gettext\
file zip unzip jq gettext\
protobuf-compiler libprotobuf-dev \
libsystemd-dev && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

COPY --from=docker /usr/bin/docker /usr/bin/docker
COPY --from=helm /usr/bin/helm /usr/bin/helm
COPY --from=golangci /bin/golangci-lint /usr/local/bin
COPY --from=drone /go/bin/drone /usr/bin/drone

# Enable go 1.11 modules to be able to install pinned version of dependencies
# even if we're installing them in the GOPATH
RUN go get \
# Install some necessary dependencies.
# Forcing GO111MODULE=on is required to specify dependencies at specific versions using the go mod notation.
# If we don't force this, Go is going to default to GOPATH mode as we do not have an active project or go.mod
# file for it to detect and switch to Go Modules automatically.
# It's possible this can be revisited in newer versions of Go if the behavior around GOPATH vs GO111MODULES changes
RUN GO111MODULE=on go get \
rfratto marked this conversation as resolved.
Show resolved Hide resolved
github.com/golang/protobuf/protoc-gen-go@v1.3.0 \
github.com/gogo/protobuf/protoc-gen-gogoslick@v1.3.0 \
github.com/gogo/protobuf/gogoproto@v1.3.0 \
Expand Down