# Multi-stage build for Go with official OpenAI SDK
FROM golang:1.22-alpine AS builder

WORKDIR /app

# Copy go mod files
COPY go.mod ./
RUN go mod download

# Copy source code
COPY main.go ./

# Build the application
RUN CGO_ENABLED=0 GOOS=linux go build -o /uncloseai main.go

# Final stage
FROM alpine:latest
WORKDIR /root/
COPY --from=builder /uncloseai ./

# Set environment variables for testing
ENV MODEL_ENDPOINT_1=https://hermes.ai.unturf.com
ENV MODEL_ENDPOINT_2=https://qwen.ai.unturf.com
ENV TTS_ENDPOINT_1=https://speech.ai.unturf.com

CMD ["./uncloseai"]
