# Development and test image for sentinel (was ja4sentinel)
# Build context: monorepo root (ja4-platform/)
# Usage: docker build -f services/sentinel/Dockerfile.dev -t sentinel-dev .
FROM golang:1.24-alpine

RUN apk add --no-cache git make libpcap-dev gcc musl-dev linux-headers

WORKDIR /build

# Copy Go workspace and shared module first for better layer caching
COPY go.work go.work.sum* ./
COPY shared/go/ja4common/ ./shared/go/ja4common/

# Copy service module descriptor then download deps
COPY services/sentinel/go.mod services/sentinel/go.sum* ./services/sentinel/
COPY services/correlator/go.mod services/correlator/go.sum* ./services/correlator/

WORKDIR /build/services/sentinel
RUN go mod download || true

# Copy full service source
COPY services/sentinel/ /build/services/sentinel/

# Default: run tests with race detector
CMD ["go", "test", "-race", "-v", "./..."]
