FROM golang:latest AS builder

WORKDIR /app/src

COPY src/ .

RUN go mod init ngtech.co.il/network/livtrace/v2 && go mod tidy

RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
    go build -ldflags="-s -w" -o /out/livetrace-linux-amd64 .

RUN CGO_ENABLED=0 GOOS=windows GOARCH=amd64 \
    go build -ldflags="-s -w" -o /out/livetrace-windows-amd64.exe .

# Stage 2: Export target
FROM scratch AS bin
COPY --from=builder /out/ /
