You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.1 KiB
48 lines
1.1 KiB
FROM golang:1.24-alpine AS builder
|
|
|
|
# Install dependencies
|
|
RUN apk add --no-cache git build-base
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy and create monitor
|
|
COPY ./docker/admin_integration/monitor.go .
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o monitor monitor.go
|
|
|
|
# Final stage
|
|
FROM alpine:latest
|
|
|
|
# Install dependencies
|
|
RUN apk --no-cache add curl ca-certificates jq
|
|
|
|
WORKDIR /root/
|
|
|
|
# Copy the binary
|
|
COPY --from=builder /app/monitor .
|
|
|
|
# Copy monitor scripts
|
|
COPY ./docker/admin_integration/monitor-entrypoint.sh /entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
# Create monitoring directories
|
|
RUN mkdir -p /monitor-data /logs
|
|
|
|
# Expose monitor port
|
|
EXPOSE 9999
|
|
|
|
# Set environment variables
|
|
ENV MASTER_ADDRESS="master:9333"
|
|
ENV ADMIN_ADDRESS="admin:9900"
|
|
ENV FILER_ADDRESS="filer:8888"
|
|
ENV MONITOR_INTERVAL="10s"
|
|
ENV LOG_LEVEL="info"
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
|
|
CMD curl -f http://localhost:9999/health || exit 1
|
|
|
|
# Start monitor
|
|
ENTRYPOINT ["/entrypoint.sh"]
|