FROM alpine:3.21 AS builder RUN apk add --no-cache \ go \ git \ && rm -rf /var/cache/apk/* ENV GOROOT /usr/lib/go ENV GOPATH /go ENV PATH /go/bin:$PATH RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin ENV GOTOOLCHAIN=auto RUN go install github.com/mailhog/MailHog@latest FROM alpine:3.20 ARG HOST_UID=1000 RUN adduser -D -u ${HOST_UID} mailhog COPY --from=builder /go/bin/MailHog /usr/local/bin/MailHog CMD ["MailHog"] HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ CMD curl --silent --fail http://localhost:8025/ || exit 1