Skip to content

Commit

Permalink
Build CI image dependencies in container
Browse files Browse the repository at this point in the history
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
  • Loading branch information
kakkoyun committed Aug 14, 2020
1 parent c7603bd commit 2223c64
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
- run:
name: "Run unit tests."
environment:
GOBIN: "/go/bin"
THANOS_TEST_OBJSTORE_SKIP: AZURE,COS,ALIYUNOSS
# Variables for Swift testing.
OS_AUTH_URL: http://127.0.0.1:5000/v2.0
Expand Down Expand Up @@ -66,6 +67,8 @@ jobs:
publish_master:
<<: *defaults
working_directory: /go/src/github.com/thanos-io/thanos
environment:
GOBIN: "/go/bin"
steps:
- checkout
- setup_remote_docker:
Expand Down
31 changes: 31 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/prometheus
/thanos
/vendor/
/mixin/vendor/
node_modules/

# Ignore minikube setup working dirs.
kube/bin
kube/.kube
kube/.minikube

# Ignore e2e working dirs.
data/
test/e2e/e2e_integration_test*

# Ignore promu artifacts.
/.build
/.release
/.tarballs

/.idea
/*.iml

website/public/
website/docs-pre-processed/
!website/data

# React build assets
pkg/ui/static/react

tmp/
13 changes: 10 additions & 3 deletions Dockerfile.thanos-ci
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Available from https://hub.docker.com/r/circleci/golang/
FROM circleci/golang:1.15-node
FROM circleci/golang:1.15 AS builder

ENV GOBIN=/go/bin
ENV BIN_DIR=/go/bin

ENV GOBIN=/home/circleci/.local/bin
WORKDIR opt
COPY Makefile .
COPY .bingo ./.bingo
RUN make install-deps

COPY --chown=circleci tmp/bin/* ${GOBIN}/
FROM circleci/golang:1.15-node
COPY --from=builder --chown=circleci /go/bin /go/bin/
5 changes: 0 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ deps: ## Ensures fresh go.mod and go.sum.
@go mod tidy
@go mod verify


.PHONY: docker
docker: ## Builds 'thanos' docker with no tag.
ifeq ($(OS)_$(ARCH), linux_x86_64)
Expand Down Expand Up @@ -233,10 +232,6 @@ install-deps: $(ALERTMANAGER) $(MINIO) $(PROMETHEUS_ARRAY)
.PHONY: docker-ci
docker-ci: ## Builds and pushes docker image used by our CI. This is done to cache our tools and dependencies. To be run by Thanos maintainer.
docker-ci: install-deps
# Copy all to tmp local dir as this is required by docker.
@rm -rf $(BIN_DIR)
@mkdir -p $(BIN_DIR)
@cp -r $(GOBIN)/* $(BIN_DIR)
@docker build -t thanos-ci -f Dockerfile.thanos-ci .
@echo ">> pushing thanos-ci image"
@docker tag "thanos-ci" "quay.io/thanos/thanos-ci:$(DOCKER_CI_TAG)"
Expand Down

0 comments on commit 2223c64

Please sign in to comment.