Skip to content

Commit

Permalink
Fix librdkafka in final Docker image (#36)
Browse files Browse the repository at this point in the history
* Bump librdkafka in final image, add test

Fixes a bug where prometheus-kafka-adapter wouldn't start because
librdkafka wasn't bumped in the final image of the multi-stage build.
Also adds a test to Travis that verifies the image can be started.

* Add stages to Travis build
  • Loading branch information
obitech authored Mar 3, 2020
1 parent d189755 commit 4f95e34
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 10 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@ language: minimal

services:
- docker
jobs:
include:
- stage: install
script: docker build -t telefonica/prometheus-kafka-adapter .

install:
- docker build -t telefonica/prometheus-kafka-adapter .
- stage: test
script:
- docker build -t telefonica/prometheus-kafka-adapter .
- docker run -d --name test telefonica/prometheus-kafka-adapter
- if [ $(docker inspect -f {{.State.Status}} test) = "running" ]; then echo "OK"; exit 0; else echo "FAILED"; exit 1; fi

git:
depth: 1
quiet: true
quiet: true
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ RUN go build -o /prometheus-kafka-adapter

FROM alpine:3.11

RUN apk add --no-cache librdkafka
RUN echo "@edge http://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories && \
echo "@edgecommunity http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && \
apk add --no-cache 'librdkafka@edgecommunity>=1.3.0'

COPY --from=build /src/prometheus-kafka-adapter/schemas/metric.avsc /schemas/metric.avsc
COPY --from=build /prometheus-kafka-adapter /
Expand Down

0 comments on commit 4f95e34

Please sign in to comment.