FROM --platform=$BUILDPLATFORM golang:1.24 AS builder

ARG TARGETARCH

WORKDIR /app
COPY ./ ./
RUN go env -w GOPROXY='https://goproxy.cn,direct' && GOOS=linux GOARCH=$TARGETARCH go build -a -o ./dist/waf-console ./cmd/

FROM ubuntu:22.04
#FROM alpine

# ARG MIRROR_SOURCE=mirrors.aliyun.com
WORKDIR /
# ADD dist/waf-console /
COPY config/waf_detection_index_template.json /
COPY --from=builder /app/dist/waf-console /waf-console
RUN ls -l /waf-console

CMD ["./waf-console"]
