FROM golang:1.22-alpine AS builder
WORKDIR /src

COPY go.mod go.sum ./
COPY main.go ./
RUN go mod download && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o /out/telemt-bot .

FROM gcr.io/distroless/static-debian12:nonroot
WORKDIR /app
COPY --from=builder /out/telemt-bot /app/telemt-bot

ENV TELEGRAM_HTTP_TIMEOUT_SECONDS=60
ENV TELEMT_HTTP_TIMEOUT_SECONDS=5

ENTRYPOINT ["/app/telemt-bot"]
