Files
zeekayandHanzo Dev 1caddc4b52 Go 1.27.1, and the code it can say more simply
Modules declare go 1.27.1 and the build images follow. go fix applied the
modernizers; omitzero is not applied, since it changes what the JSON says.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-16 19:05:42 -07:00

36 lines
1.1 KiB
Docker

# syntax=docker/dockerfile:1
FROM --platform=$BUILDPLATFORM golang:1.27.1-alpine AS builder
# go.mod pins the toolchain. The golang base image sets GOTOOLCHAIN=local,
# which turns a `go` directive newer than the image into a hard build
# failure instead of a download.
ENV GOTOOLCHAIN=auto
ARG TARGETOS=linux
ARG TARGETARCH=amd64
RUN apk add --no-cache git
WORKDIR /src
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download
COPY . .
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-s -w" -o /hanzo-amqp ./cmd/amqp
FROM alpine:3.20
LABEL org.opencontainers.image.source="https://github.com/hanzoai/amqp"
LABEL org.opencontainers.image.description="Hanzo AMQP - RabbitMQ-compatible AMQP 0-9-1 gateway over NATS"
LABEL org.opencontainers.image.licenses="MIT"
RUN apk add --no-cache ca-certificates
COPY --from=builder /hanzo-amqp /usr/local/bin/hanzo-amqp
EXPOSE 5672
ENTRYPOINT ["hanzo-amqp"]
CMD ["--pubsub-url", "nats://pubsub:4222", "--addr", "0.0.0.0:5672"]