Skip to content

Commit

Permalink
Simple Dockerfile for kaf.
Browse files Browse the repository at this point in the history
Signed-off-by: kwall <kwall@apache.org>
  • Loading branch information
k-wall committed Jan 18, 2024
1 parent 9ac8c1a commit 39cf10d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM golang:1.18 as BuildStage

# Set destination for COPY
WORKDIR /app

# Download Go modules
COPY go.mod go.sum ./
RUN go mod download
COPY . ./

# Build
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-w -s" -o /kaf ./cmd/kaf

FROM scratch

WORKDIR /

COPY --from=BuildStage /kaf /bin/kaf

USER 1001

# Run
CMD ["/bin/kaf"]
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
DOCKER_CMD ?= docker
DOCKER_REGISTRY ?= docker.io
DOCKER_ORG ?= $(USER)
DOCKER_NAME ?= kaf
DOCKER_TAG ?= latest
BUILD_TAG ?= latest

build:
go build -ldflags "-w -s" ./cmd/kaf
install:
Expand All @@ -6,3 +13,5 @@ release:
goreleaser --rm-dist
run-kafka:
docker-compose up -d
docker-build:
${DOCKER_CMD} build -t ${DOCKER_REGISTRY}/${DOCKER_ORG}/${DOCKER_NAME}:${DOCKER_TAG} .

0 comments on commit 39cf10d

Please # to comment.