# Build the manager binary
FROM golang:1.16 as builder

ARG TARGETARCH

WORKDIR /workspace

# Copy the go source
COPY . .

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} GO111MODULE=on go build -mod=vendor -a -o audit cmd/audit/main.go

FROM gcr.io/pingcap-public/pingcap/alpine-glibc:alpine-3.14.3
WORKDIR /
COPY --from=builder /workspace/audit .

ENTRYPOINT ["/audit"]
