mirror of
https://github.com/hanzoai/amqp.git
synced 2026-10-30 14:57:07 +00:00
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]>
36 lines
1.1 KiB
Docker
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"]
|