# Build the manager binary
FROM golang:1.16 as builder

WORKDIR /workspace

# Copy the go source
COPY /hack/grab-manifest.sh hack/grab-manifest.sh

# grab manifests need to deplop network/cluster
RUN ./hack/grab-manifest.sh ./grab-manifests

COPY manifests grab-manifests/manifests

FROM gcr.io/pingcap-public/pingcap/alpine-glibc:alpine-3.14.3

COPY bin/manager /manager
COPY bin/webhook /webhook

# Copy manifests to the default path used by infra-provider
COPY --from=builder /workspace/grab-manifests/manifests /manifests
COPY --from=builder /workspace/grab-manifests/charts /charts
COPY --from=builder /workspace/grab-manifests/bin /bin

ENTRYPOINT ["/manager"]
