Skip to content

Commit

Permalink
Add Dockerfile and docker compose config
Browse files Browse the repository at this point in the history
  • Loading branch information
weeco committed Feb 14, 2021
1 parent 7d34e70 commit f157ed4
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 212 deletions.
24 changes: 18 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
# build image
############################################################
# Build image
############################################################
FROM golang:1.15-alpine as builder
RUN apk update && apk add --no-cache git ca-certificates && update-ca-certificates

WORKDIR /app

COPY go.mod .
COPY go.sum .
RUN go mod download

COPY . .

RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -installsuffix cgo -o /go/bin/kafka-minion
RUN CGO_ENABLED=0 go build -o ./bin/kminion

# executable image
############################################################
# Runtime Image
############################################################
FROM alpine:3
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /go/bin/kafka-minion /go/bin/kafka-minion
COPY --from=builder /app/bin/kminion /app/kminion

# Embed env vars in final image as well (so the backend can read them)
ARG KMINION_VERSION
ENV KMINION_VERSION ${KMINION_VERSION}

ENV VERSION 1.0.2
ENTRYPOINT ["/go/bin/kafka-minion"]
ENTRYPOINT ["/app/kminion"]
45 changes: 0 additions & 45 deletions docker-compose-kafka-2.6.yml

This file was deleted.

118 changes: 0 additions & 118 deletions docker-compose-multiple.yml

This file was deleted.

79 changes: 36 additions & 43 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,47 @@
version: "2.1"
---
version: '2.1'

services:
kafkahq:
image: tchiotludo/kafkahq:0.8.0
environment:
MICRONAUT_APPLICATION_JSON: |
{
"kafkahq": {
"connections": {
"docker-kafka-server": {
"properties": {
"bootstrap.servers": "kafka1:19092"
}
}
}
}
}
ports:
- 8080:8080
links:
- kafka1

zoo1:
image: zookeeper:3.4.9
hostname: zoo1
zookeeper:
image: confluentinc/cp-zookeeper:latest
ports:
- "2181:2181"
- 2181:2181
environment:
ZOO_MY_ID: 1
ZOO_PORT: 2181
ZOO_SERVERS: server.1=zoo1:2888:3888
volumes:
- ./zk-single-kafka-single/zoo1/data:/data
- ./zk-single-kafka-single/zoo1/datalog:/datalog
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
container_name: zookeeper
hostname: zookeeper

kafka1:
image: confluentinc/cp-kafka:5.1.2
hostname: kafka1
kafka:
image: confluentinc/cp-kafka:latest
hostname: kafka
container_name: kafka
depends_on:
- zookeeper
ports:
- "9092:9092"
- 9092:9092
environment:
KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER_INTERNAL://kafka1:19092,LISTENER_DOCKER_EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER_INTERNAL
KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181"
KAFKA_BROKER_ID: 1
KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO"
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_DELETE_TOPIC_ENABLE: "true"
volumes:
- ./zk-single-kafka-single/kafka1/data:/var/lib/kafka/data
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1

kafka-minion:
build:
context: .
dockerfile: ./Dockerfile
hostname: kafka-minion
container_name: kafka-minion
depends_on:
- zoo1
- zookeeper
- kafka
ports:
- 8080:8080
environment:
KAFKA_BROKERS: kafka:29092
restart: unless-stopped

0 comments on commit f157ed4

Please sign in to comment.