| |
| |
|
|
| FROM golang:1.24-alpine AS builder |
|
|
| WORKDIR /app |
|
|
| COPY go.mod go.sum ./ |
|
|
| RUN go mod download |
|
|
| COPY . . |
|
|
| ARG VERSION=dev |
| ARG COMMIT=none |
| ARG BUILD_DATE=unknown |
|
|
| RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w -X 'main.Version=${VERSION}' -X 'main.Commit=${COMMIT}' -X 'main.BuildDate=${BUILD_DATE}'" -o ./CLIProxyAPI ./cmd/server/ |
|
|
| FROM python:3.11-slim |
|
|
| |
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| tzdata \ |
| ca-certificates \ |
| curl \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN mkdir -p /app |
|
|
| |
| COPY --from=builder /app/CLIProxyAPI /app/CLIProxyAPI |
|
|
| |
| COPY config.example.yaml /app/config.example.yaml |
|
|
| |
| COPY kiro-gateway/requirements.txt /app/kiro-requirements.txt |
| RUN pip install --no-cache-dir -r /app/kiro-requirements.txt 2>/dev/null || true |
|
|
| |
| COPY kiro-gateway/kiro /app/kiro/ |
|
|
| WORKDIR /app |
|
|
| |
| EXPOSE 7860 |
|
|
| |
| ENV TZ=UTC |
| ENV PORT=7860 |
| ENV HOST=0.0.0.0 |
|
|
| |
| RUN echo '#!/bin/sh\n\ |
| set -e\n\ |
| \n\ |
| # Create config from environment variables if provided\n\ |
| # Only KIRO_REFRESH_TOKEN is required - profile-arn is auto-fetched from token refresh\n\ |
| if [ -n "$KIRO_REFRESH_TOKEN" ]; then\n\ |
| cat > /app/config.yaml << EOF\n\ |
| host: "0.0.0.0"\n\ |
| port: 7860\n\ |
| auth-dir: "/app/auth"\n\ |
| debug: ${DEBUG:-false}\n\ |
| \n\ |
| api-keys:\n\ |
| - "${API_KEY:-default-key}"\n\ |
| \n\ |
| kiro-api-key:\n\ |
| - refresh-token: "$KIRO_REFRESH_TOKEN"\n\ |
| region: "${KIRO_REGION:-us-east-1}"\n\ |
| EOF\n\ |
| echo "Config created from environment variables"\n\ |
| elif [ -f /app/config.yaml ]; then\n\ |
| echo "Using existing config.yaml"\n\ |
| else\n\ |
| cp /app/config.example.yaml /app/config.yaml\n\ |
| echo "Using example config"\n\ |
| fi\n\ |
| \n\ |
| mkdir -p /app/auth\n\ |
| \n\ |
| exec ./CLIProxyAPI -config /app/config.yaml\n\ |
| ' > /app/start.sh && chmod +x /app/start.sh |
|
|
| CMD ["/app/start.sh"] |
|
|