feat: migrate backend from rust to go
Some checks failed
CI / Check (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Formatting (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / Release Build (push) Has been cancelled

This commit replaces the Axum/Rust backend with a Gin/Go implementation. The original Rust code has been archived in the 'rust' branch.
This commit is contained in:
2026-03-19 10:30:05 -04:00
parent 649371154f
commit 6b10d4249c
69 changed files with 3460 additions and 15096 deletions

View File

@@ -1,35 +1,34 @@
# ── Build stage ──────────────────────────────────────────────
FROM rust:1-bookworm AS builder
# Build stage
FROM golang:1.22-alpine AS builder
WORKDIR /app
# Cache dependency build
COPY Cargo.toml Cargo.lock ./
RUN mkdir src && echo 'fn main() {}' > src/main.rs && \
cargo build --release && \
rm -rf src
# Copy go mod and sum files
COPY go.mod go.sum ./
RUN go mod download
# Build the actual binary
COPY src/ src/
RUN touch src/main.rs && cargo build --release
# Copy the source code
COPY . .
# ── Runtime stage ────────────────────────────────────────────
FROM debian:bookworm-slim
# Build the application
RUN CGO_ENABLED=0 GOOS=linux go build -o llm-proxy ./cmd/llm-proxy
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates && \
rm -rf /var/lib/apt/lists/*
# Final stage
FROM alpine:latest
RUN apk --no-cache add ca-certificates tzdata
WORKDIR /app
COPY --from=builder /app/target/release/llm-proxy /app/llm-proxy
COPY static/ /app/static/
# Copy the binary from the builder stage
COPY --from=builder /app/llm-proxy .
COPY --from=builder /app/static ./static
# Default config location
VOLUME ["/app/config", "/app/data"]
# Create data directory
RUN mkdir -p /app/data
# Expose port
EXPOSE 8080
ENV RUST_LOG=info
ENTRYPOINT ["/app/llm-proxy"]
# Run the application
CMD ["./llm-proxy"]