feat: migrate backend from rust to go
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:
43
Dockerfile
43
Dockerfile
@@ -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"]
|
||||
|
||||
Reference in New Issue
Block a user