Skip to content

Commit

Permalink
Merge pull request #52 from dalehamel/ubuntu-images
Browse files Browse the repository at this point in the history
fix: Build ubuntu image and use them instead of alpine

Co-authored-by: Lorenzo Fontana <[email protected]>
Co-authored-by: Leo Di Donato <[email protected]>
  • Loading branch information
leodido and fntlnz authored Aug 31, 2019
2 parents 82e3597 + ed5bb60 commit d03517f
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 110 deletions.
46 changes: 0 additions & 46 deletions Dockerfile.bpftracebase

This file was deleted.

22 changes: 0 additions & 22 deletions Dockerfile.tracerunner

This file was deleted.

42 changes: 15 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,20 @@ GIT_COMMIT := $(if $(shell git status --porcelain --untracked-files=no),${COMMIT
GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
GIT_BRANCH_CLEAN := $(shell echo $(GIT_BRANCH) | sed -e "s/[^[:alnum:]]/-/g")

IMAGE_NAME ?= quay.io/iovisor/kubectl-trace-bpftrace
IMAGE_NAME_BASE ?= quay.io/iovisor/kubectl-trace-bpftrace-base

IMAGE_NAME_INIT ?= quay.io/iovisor/kubectl-trace-init
IMAGE_NAME ?= quay.io/iovisor/kubectl-trace-bpftrace

IMAGE_TRACERUNNER_BRANCH := $(IMAGE_NAME):$(GIT_BRANCH_CLEAN)
IMAGE_TRACERUNNER_COMMIT := $(IMAGE_NAME):$(GIT_COMMIT)
IMAGE_TRACERUNNER_LATEST := $(IMAGE_NAME):latest

IMAGE_INITCONTAINER_BRANCH := $(IMAGE_NAME_INIT):$(GIT_BRANCH_CLEAN)
IMAGE_INITCONTAINER_COMMIT := $(IMAGE_NAME_INIT):$(GIT_COMMIT)
IMAGE_INITCONTAINER_LATEST := $(IMAGE_NAME_INIT):latest

BPFTRACESHA ?= aaed58fbb365a21f5a609521b1fc8e53aa67a97f
BCCVERSION ?= 0.8.0
IMAGE_BPFTRACE_BASE := $(IMAGE_NAME_BASE):$(BPFTRACESHA)

IMAGE_BUILD_FLAGS ?= "--no-cache"

BPFTRACEVERSION ?= "0.9.2-1"

LDFLAGS := -ldflags '-X github.com/iovisor/kubectl-trace/pkg/version.buildTime=$(shell date +%s) -X github.com/iovisor/kubectl-trace/pkg/version.gitCommit=${GIT_COMMIT} -X github.com/iovisor/kubectl-trace/pkg/cmd.ImageNameTag=${IMAGE_TRACERUNNER_COMMIT} -X github.com/iovisor/kubectl-trace/pkg/cmd.InitImageNameTag=${IMAGE_INITCONTAINER_COMMIT}'
TESTPACKAGES := $(shell go list ./... | grep -v github.com/iovisor/kubectl-trace/integration)

Expand All @@ -46,24 +41,25 @@ ${trace_runner}:
clean:
rm -Rf _output

.PHONY: image/build
image/build:
$(DOCKER) build \
--build-arg bpftracesha=$(BPFTRACESHA) \
--build-arg imagenamebase=$(IMAGE_NAME_BASE) \
$(IMAGE_BUILD_FLAGS) \
-t $(IMAGE_TRACERUNNER_BRANCH) \
-f Dockerfile.tracerunner .
$(DOCKER) tag $(IMAGE_TRACERUNNER_BRANCH) $(IMAGE_TRACERUNNER_COMMIT)

.PHONY: image/build-init
image/build-init:
$(DOCKER) build \
$(IMAGE_BUILD_FLAGS) \
-t $(IMAGE_INITCONTAINER_BRANCH) \
-f ./init/Dockerfile.initcontainer ./init
-f ./build/Dockerfile.initcontainer ./build
$(DOCKER) tag $(IMAGE_INITCONTAINER_BRANCH) $(IMAGE_INITCONTAINER_COMMIT)

.PHONY: image/build
image/build:
$(DOCKER) build \
--build-arg bpftraceversion=$(BPFTRACEVERSION) \
$(IMAGE_BUILD_FLAGS) \
-t "$(IMAGE_TRACERUNNER_BRANCH)" \
-f build/Dockerfile.tracerunner .
$(DOCKER) tag $(IMAGE_TRACERUNNER_BRANCH) $(IMAGE_TRACERUNNER_COMMIT)
$(DOCKER) tag "$(IMAGE_TRACERUNNER_BRANCH)" $(IMAGE_TRACERUNNER_BRANCH)


.PHONY: image/push
image/push:
$(DOCKER) push $(IMAGE_TRACERUNNER_BRANCH)
Expand All @@ -85,11 +81,3 @@ test:
.PHONY: integration
integration:
TEST_KUBECTLTRACE_BINARY=$(shell pwd)/$(kubectl_trace) $(GO) test ${LDFLAGS} -v ./integration/...

.PHONY: bpftraceimage/build
bpftraceimage/build:
$(DOCKER) build --build-arg bccversion=$(BCCVERSION) --build-arg bpftracesha=$(BPFTRACESHA) $(IMAGE_BUILD_FLAGS) -t $(IMAGE_BPFTRACE_BASE) -f Dockerfile.bpftracebase .

.PHONY: bpftraceimage/push
bpftraceimage/push:
$(DOCKER) push $(IMAGE_BPFTRACE_BASE)
15 changes: 15 additions & 0 deletions build/Dockerfile.initcontainer
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM alpine:3.8
RUN apk add --update \
bash \
bc \
build-base \
curl \
libelf-dev \
linux-headers \
make

WORKDIR /

COPY /init/fetch-linux-headers.sh /

ENTRYPOINT [ "/fetch-linux-headers.sh" ]
18 changes: 18 additions & 0 deletions build/Dockerfile.tracerunner
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM golang:1.11.4-stretch as gobuilder

RUN apt-get update
RUN apt-get install -y make bash git

ADD . /go/src/github.com/iovisor/kubectl-trace
WORKDIR /go/src/github.com/iovisor/kubectl-trace

RUN make _output/bin/trace-runner

FROM ubuntu:19.10
ARG bpftraceversion=0.9.2-1
RUN apt-get update && apt-get install -y bpftrace=${bpftraceversion} && \
rm -rf /var/lib/apt/lists/* && apt-get clean

COPY --from=gobuilder /go/src/github.com/iovisor/kubectl-trace/_output/bin/trace-runner /bin/trace-runner

ENTRYPOINT ["/bin/trace-runner"]
File renamed without changes.
15 changes: 0 additions & 15 deletions init/Dockerfile.initcontainer

This file was deleted.

0 comments on commit d03517f

Please sign in to comment.