From e0c05c6100c93005f400ac8ba66eeb7f22c12aa3 Mon Sep 17 00:00:00 2001 From: Mikkel Oscar Lyderik Larsen Date: Fri, 31 Aug 2018 21:48:45 +0200 Subject: [PATCH] Build lightstep image based on alpine Signed-off-by: Mikkel Oscar Lyderik Larsen --- packaging/Dockerfile.alpine | 9 +++++++++ packaging/Dockerfile.lightstep | 9 +++++++-- packaging/Makefile | 31 +++++++++++++++++++++++-------- 3 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 packaging/Dockerfile.alpine diff --git a/packaging/Dockerfile.alpine b/packaging/Dockerfile.alpine new file mode 100644 index 0000000000..546097a5ae --- /dev/null +++ b/packaging/Dockerfile.alpine @@ -0,0 +1,9 @@ +FROM golang:alpine + +ENV CGO_ENABLED 1 +ENV GOOS linux +ENV GOARCH amd64 + +# add build deps +RUN apk add -U git build-base && \ + go get github.com/Masterminds/glide diff --git a/packaging/Dockerfile.lightstep b/packaging/Dockerfile.lightstep index b439cec603..0e6def0358 100644 --- a/packaging/Dockerfile.lightstep +++ b/packaging/Dockerfile.lightstep @@ -1,7 +1,12 @@ -FROM registry.opensource.zalan.do/stups/ubuntu:latest +FROM registry.opensource.zalan.do/stups/alpine:latest MAINTAINER Skipper Maintainers +RUN apk --no-cache add ca-certificates && update-ca-certificates +RUN mkdir -p /usr/bin ADD skipper eskip /usr/bin/ -EXPOSE 9090 9911 +ENV PATH $PATH:/usr/bin RUN mkdir -p /plugins ADD build/tracing_lightstep.so /plugins/ + +EXPOSE 9090 9911 + ENTRYPOINT ["/usr/bin/skipper", "-plugindir", "/plugins"] diff --git a/packaging/Makefile b/packaging/Makefile index bff06d9fd0..5d107ef18a 100644 --- a/packaging/Makefile +++ b/packaging/Makefile @@ -1,18 +1,20 @@ .PHONY: docker-push -VERSION ?= $(shell git rev-parse HEAD) -REGISTRY ?= registry-write.opensource.zalan.do/pathfinder -IMAGE ?= $(REGISTRY)/skipper:$(VERSION) -LIGHTSTEP_IMAGE ?= $(REGISTRY)/skipper-lightstep:$(VERSION) -CGO_ENABLED ?= 0 +VERSION ?= $(shell git rev-parse HEAD) +REGISTRY ?= registry-write.opensource.zalan.do/pathfinder +IMAGE ?= $(REGISTRY)/skipper:$(VERSION) +LIGHTSTEP_IMAGE ?= $(REGISTRY)/skipper-lightstep:$(VERSION) +ALPINE_BUILD_IMAGE ?= $(REGISTRY)/skipper-alpine-build:latest +PACKAGE ?= github.com/zalando/skipper +CGO_ENABLED ?= 0 default: docker-build skipper: - GOOS=linux GOARCH=amd64 CGO_ENABLED=$(CGO_ENABLED) go build github.com/zalando/skipper/cmd/skipper + GOOS=linux GOARCH=amd64 CGO_ENABLED=$(CGO_ENABLED) go build $(PACKAGE)/cmd/skipper eskip: - GOOS=linux GOARCH=amd64 CGO_ENABLED=$(CGO_ENABLED) go build github.com/zalando/skipper/cmd/eskip + GOOS=linux GOARCH=amd64 CGO_ENABLED=$(CGO_ENABLED) go build $(PACKAGE)/cmd/eskip clean: rm -rf skipper eskip build/ @@ -31,7 +33,20 @@ plugins: GOOS=linux GOARCH=amd64 CGO_ENABLED=1 make ;\ cp build/*.so $$CUR/build/ -docker-lightstep-build: skipper eskip plugins +alpine.build: docker-alpine-build + docker run -v $(shell pwd)/..:/go/src/$(PACKAGE) \ + -w /go/src/$(PACKAGE)/packaging $(ALPINE_BUILD_IMAGE) \ + make skipper eskip + +alpine.plugins: docker-alpine-build + docker run -v $(shell pwd)/..:/go/src/$(PACKAGE) \ + -w /go/src/$(PACKAGE)/packaging $(ALPINE_BUILD_IMAGE) \ + make plugins + +docker-alpine-build: + docker build --rm -t $(ALPINE_BUILD_IMAGE) -f Dockerfile.alpine . + +docker-lightstep-build: alpine.build alpine.plugins docker build -t $(LIGHTSTEP_IMAGE) -f Dockerfile.lightstep . docker-lightstep-push: