Skip to content

Commit

Permalink
Merge pull request #297 from k-wall/dockerfile
Browse files Browse the repository at this point in the history
Simple Dockerfile for kaf.
  • Loading branch information
birdayz authored Feb 19, 2024
2 parents 9ac8c1a + 6c60f41 commit f786914
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.22 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 f786914

Please sign in to comment.