FROM golang:1.17 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum

# Copy the go source
COPY . .

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o eks-provider main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM public.ecr.aws/bitnami/aws-cli:2.4.18
WORKDIR /
COPY --from=builder /workspace/eks-provider .
USER 65532:65532
ENTRYPOINT ["/eks-provider"]
