# Build Stage
FROM golang:1.26.1-trixie AS build

# Install build dependencies
RUN apt-get update && apt-get install -y \
    git \
    libpcap-dev \
    make \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY go.mod go.sum ./
RUN go mod download && go mod verify

COPY . .

RUN CGO_ENABLED=1 go build -o honeypot .

# Run Stage
FROM debian:trixie-slim

# Install runtime dependencies
RUN apt-get update && apt-get install -y \
    libpcap-dev \
    ca-certificates \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY --from=build /app/honeypot ./honeypot

# Config and Data Volumes
VOLUME /opt/data

ENV CONFIG_FILE=/opt/data/config.json

CMD ["sh", "-c", "./honeypot -config \"$CONFIG_FILE\""]
