Skip to content

Commit 4c7dd35

Browse files
committed
Build additional image with all plugins
1 parent 14a5936 commit 4c7dd35

File tree

5 files changed

+66
-28
lines changed

5 files changed

+66
-28
lines changed

.travis.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,17 @@ script:
2525
- go build .
2626
- go test ./...
2727
- export TAG=`if [[ $TRAVIS_PULL_REQUEST == "false" ]] && [[ $TRAVIS_BRANCH == "master" ]]; then echo "latest"; else echo "${TRAVIS_PULL_REQUEST_BRANCH:-${TRAVIS_BRANCH}}"; fi`
28-
- echo "docker tag $TAG"
29-
- docker build -t $REPO:$TAG -f Dockerfile .
28+
- echo "docker tags $TAG and ${TAG}-all"
29+
- docker build --build-arg MAKE_TARGET="test build" -t $REPO:$TAG -f Dockerfile .
30+
- docker build --build-arg MAKE_TARGET="all" -t $REPO:${TAG}-all -f Dockerfile .
3031

3132
after_success:
3233
- echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin
3334
- if [[ $TRAVIS_PULL_REQUEST == "false" ]] && [[ $TRAVIS_BRANCH == "master" ]]; then
34-
docker tag $REPO:$TAG $REPO:$TRAVIS_BUILD_NUMBER; docker push $REPO:$TRAVIS_BUILD_NUMBER;
35+
docker tag $REPO:$TAG $REPO:$TRAVIS_BUILD_NUMBER
36+
docker tag $REPO:${TAG}-all $REPO:${TRAVIS_BUILD_NUMBER}-all
37+
docker push $REPO:$TRAVIS_BUILD_NUMBER
38+
docker push $REPO:${TRAVIS_BUILD_NUMBER}-all
3539
fi
3640
- docker push $REPO:$TAG
41+
- docker push $REPO:${TAG}-all

Dockerfile

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1-
FROM alpine:3.11
1+
FROM golang:1.14-alpine3.12 as builder
2+
RUN apk add alpine-sdk ca-certificates
23

3-
RUN apk add --no-cache ca-certificates
4+
WORKDIR /go/src/github.com/grepplabs/kafka-proxy
5+
COPY . .
6+
7+
ARG MAKE_TARGET=build
8+
ARG GOOS=linux
9+
ARG GOARCH=amd64
10+
RUN make -e GOARCH=${GOARCH} -e GOOS=${GOOS} clean ${MAKE_TARGET}
411

5-
ADD kafka-proxy /kafka-proxy
12+
FROM alpine:3.12
13+
RUN apk add --no-cache ca-certificates
614

7-
ENTRYPOINT ["/kafka-proxy"]
15+
COPY --from=builder /go/src/github.com/grepplabs/kafka-proxy/build /opt/kafka-proxy/bin
16+
ENTRYPOINT ["/opt/kafka-proxy/bin/kafka-proxy"]
817
CMD ["--help"]

Dockerfile.build

Lines changed: 0 additions & 17 deletions
This file was deleted.

Makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.DEFAULT_GOAL := build
22

3-
.PHONY: clean build build.docker tag all
3+
.PHONY: clean build all tag release
44

55
BINARY ?= kafka-proxy
66
SOURCES = $(shell find . -name '*.go' | grep -v /vendor/)
@@ -33,9 +33,6 @@ build: build/$(BINARY)
3333
build/$(BINARY): $(SOURCES)
3434
GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 go build -o build/$(BINARY) $(BUILD_FLAGS) -ldflags "$(LDFLAGS)" .
3535

36-
docker.build:
37-
docker build --build-arg GOOS=$(GOOS) --build-arg GOARCH=$(GOARCH) -f Dockerfile.build .
38-
3936
tag:
4037
git tag $(TAG)
4138

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,50 @@ See:
5252
5353
make clean build
5454
55+
### Docker images
56+
57+
Docker images are available on [Docker Hub](https://hub.docker.com/r/grepplabs/kafka-proxy/tags).
58+
59+
You can launch a kafka-proxy container for trying it out with
60+
61+
docker run --rm -p 30001-30003:30001-30003 grepplabs/kafka-proxy:v0.2.6 \
62+
server \
63+
--bootstrap-server-mapping "localhost:19092,0.0.0.0:30001" \
64+
--bootstrap-server-mapping "localhost:29092,0.0.0.0:30002" \
65+
--bootstrap-server-mapping "localhost:39092,0.0.0.0:30003" \
66+
--dial-address-mapping "localhost:19092,172.17.0.1:19092" \
67+
--dial-address-mapping "localhost:29092,172.17.0.1:29092" \
68+
--dial-address-mapping "localhost:39092,172.17.0.1:39092" \
69+
--debug-enable
70+
71+
Kafka-proxy will now be reachable on `localhost:30001`, `localhost:30002` and `localhost:30003`, connecting to kafka brokers
72+
running in docker (network bridge gateway `172.17.0.1`) advertising PLAINTEXT listeners on `localhost:19092`, `localhost:29092` and `localhost:39092`.
73+
74+
### Docker images with precompiled plugins
75+
76+
Docker images with precompiled plugins located in `/opt/kafka-proxy/bin/` are tagged with `<release>-all`.
77+
78+
You can launch a kafka-proxy container with auth-ldap plugin for trying it out with
79+
80+
docker run --rm -p 30001-30003:30001-30003 grepplabs/kafka-proxy:v0.2.6-all \
81+
server \
82+
--bootstrap-server-mapping "localhost:19092,0.0.0.0:30001" \
83+
--bootstrap-server-mapping "localhost:29092,0.0.0.0:30002" \
84+
--bootstrap-server-mapping "localhost:39092,0.0.0.0:30003" \
85+
--dial-address-mapping "localhost:19092,172.17.0.1:19092" \
86+
--dial-address-mapping "localhost:29092,172.17.0.1:29092" \
87+
--dial-address-mapping "localhost:39092,172.17.0.1:39092" \
88+
--debug-enable \
89+
--auth-local-enable \
90+
--auth-local-command=/opt/kafka-proxy/bin/auth-ldap \
91+
--auth-local-param=--url=ldap://172.17.0.1:389 \
92+
--auth-local-param=--start-tls=false \
93+
--auth-local-param=--bind-dn=cn=admin,dc=example,dc=org \
94+
--auth-local-param=--bind-passwd=admin \
95+
--auth-local-param=--user-search-base=ou=people,dc=example,dc=org \
96+
--auth-local-param=--user-filter="(&(objectClass=person)(uid=%u)(memberOf=cn=kafka-users,ou=realm-roles,dc=example,dc=org))"
97+
98+
5599
### Help output
56100
57101
Run the kafka-proxy server

0 commit comments

Comments
 (0)