## Install dependencies
FROM harbor.kvazaric.ru/mirror/library/python:3.12 as deps

WORKDIR /application
COPY ./requirements.txt ./

RUN apt-get update -y && \
    apt-get install sshpass -y && \
    pip3 install -r requirements.txt

## Build executable
FROM harbor.kvazaric.ru/mirror/library/golang:alpine as builder

WORKDIR /application
COPY go.mod go.sum ./
RUN go mod download

WORKDIR /application
COPY . .
RUN CGO_ENABLED=0 GOOS=linux  go build -v -o kube-forge ./cmd/main/main.go

FROM deps

WORKDIR /application
COPY . .
COPY --from=builder /application/kube-forge /application/kube-forge

ENV ANSIBLE_HOST_KEY_CHECKING=False
ENTRYPOINT ["./kube-forge", "-c", "config.yaml", "-d", "."]
