Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docker compose health check #22

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions Dockerfile.consume
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# This allows users to try out this demo without needing to have Go installed, as well
# as makes the demo runnable within docker compose.
FROM --platform=$BUILDPLATFORM golang:1.23-alpine3.20 AS builder
FROM --platform=$BUILDPLATFORM golang:1.23-bookworm AS builder

ARG TARGETOS TARGETARCH
ENV CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH
Expand All @@ -16,11 +16,7 @@ RUN go mod download
COPY . /app
RUN go build -ldflags "-s -w" -trimpath -buildvcs=false -o /go/bin/bufstream-demo-consume ./cmd/bufstream-demo-consume

FROM alpine:3.20.3

RUN apk add --update --no-cache \
ca-certificates && \
rm -rf /var/cache/apk/*
FROM gcr.io/distroless/static-debian12:nonroot

COPY --from=builder /go/bin/bufstream-demo-consume /bufstream-demo-consume
ENTRYPOINT ["/bufstream-demo-consume"]
8 changes: 2 additions & 6 deletions Dockerfile.produce
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# This allows users to try out this demo without needing to have Go installed, as well
# as makes the demo runnable within docker compose.
FROM --platform=$BUILDPLATFORM golang:1.23-alpine3.20 AS builder
FROM --platform=$BUILDPLATFORM golang:1.23-bookworm AS builder

ARG TARGETOS TARGETARCH
ENV CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH
Expand All @@ -16,11 +16,7 @@ RUN go mod download
COPY . /app
RUN go build -ldflags "-s -w" -trimpath -buildvcs=false -o /go/bin/bufstream-demo-produce ./cmd/bufstream-demo-produce

FROM alpine:3.20.3

RUN apk add --update --no-cache \
ca-certificates && \
rm -rf /var/cache/apk/*
FROM gcr.io/distroless/static-debian12:nonroot

COPY --from=builder /go/bin/bufstream-demo-produce /bufstream-demo-produce
ENTRYPOINT ["/bufstream-demo-produce"]
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
# We'll expose bufstream on the host at port 9092.
- "9092:9092"
healthcheck:
test: nc -z bufstream 9092 || exit -1
test: ["CMD", "/usr/local/bin/bufstream", "admin", "status", "--exit-code", "--url", "http://127.0.0.1:9089"]
start_period: 15s
interval: 5s
timeout: 10s
Expand Down