# Build stage FROM golang:1.26-alpine AS builder WORKDIR /app # Install git and patch RUN apk add --no-cache git patch # Clone the upstream repository RUN git clone https://github.com/Router-for-me/CLIProxyAPI . # Copy and apply the verification fix patch COPY auth_fix.patch . RUN patch -p1 < auth_fix.patch # Download dependencies RUN go mod download # Build the application RUN go build -o CLIProxyAPI cmd/server/main.go # Final stage FROM alpine:latest WORKDIR /CLIProxyAPI # Copy binary and config from builder COPY --from=builder /app/CLIProxyAPI /CLIProxyAPI/CLIProxyAPI COPY --from=builder /app/config.example.yaml /CLIProxyAPI/config.example.yaml # Copy local config and entrypoint COPY config.yaml /CLIProxyAPI/config.yaml COPY entrypoint.sh /CLIProxyAPI/entrypoint.sh # Create necessary directories and set permissions RUN mkdir -p /CLIProxyAPI/auth /CLIProxyAPI/logs && \ chmod 777 /CLIProxyAPI/auth /CLIProxyAPI/logs && \ chmod +x /CLIProxyAPI/entrypoint.sh # Expose port EXPOSE 8080 # Set entrypoint ENTRYPOINT ["/CLIProxyAPI/entrypoint.sh"]