xcolorday commited on
Commit
c78fa08
·
verified ·
1 Parent(s): 605cde4

Update Cargo.toml

Browse files
Files changed (1) hide show
  1. Cargo.toml +109 -66
Cargo.toml CHANGED
@@ -1,66 +1,109 @@
1
- # 使用 nightly 版本的 Rust 来支持不稳定功能
2
- FROM rustlang/rust:nightly-bookworm-slim as builder
3
-
4
- # 安装构建依赖
5
- RUN apt-get update && apt-get install -y \
6
- pkg-config \
7
- libssl-dev \
8
- clang \
9
- protobuf-compiler \
10
- && rm -rf /var/lib/apt/lists/*
11
-
12
- WORKDIR /app
13
-
14
- # 复制 Cargo.toml
15
- COPY Cargo.toml ./
16
-
17
- # 创建虚拟源文件以允许依赖解析
18
- RUN mkdir -p src && \
19
- echo '#[tokio::main]' > src/main.rs && \
20
- echo 'async fn main() { println!("Building dependencies..."); }' >> src/main.rs
21
-
22
- # 预构建依赖(不使用 --locked 标志)
23
- RUN cargo build --release
24
- RUN rm -rf src target/release/deps/cursor_api*
25
-
26
- # 复制所有源代码
27
- COPY src ./src
28
-
29
- # 检查并复制补丁目录(如果存在)
30
- COPY patch ./patch || echo "No patch directory found, continuing..."
31
-
32
- # 复制其他文件
33
- COPY tools ./tools
34
- COPY build.rs ./
35
-
36
- # 构建应用
37
- RUN cargo build --release
38
-
39
- # 多阶段构建 - 运行时镜像
40
- FROM debian:bookworm-slim
41
-
42
- # 安装运行时依赖
43
- RUN apt-get update && apt-get install -y \
44
- ca-certificates \
45
- && rm -rf /var/lib/apt/lists/* \
46
- && apt-get clean
47
-
48
- WORKDIR /app
49
-
50
- # 从构建阶段复制可执行文件
51
- COPY --from=builder /app/target/release/cursor-api /usr/local/bin/cursor-api
52
-
53
- # 创建非 root 用户
54
- RUN groupadd -r user && useradd -r -g user -u 1000 user
55
-
56
- # 设置正确的权限
57
- RUN chmod +x /usr/local/bin/cursor-api
58
-
59
- # 暴露 Hugging Face Spaces 标准端口
60
- EXPOSE 7860
61
-
62
- # 切换到非 root 用户
63
- USER user
64
-
65
- # 启动命令 - 确保应用监听 7860 端口
66
- CMD ["cursor-api"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ cargo-features = ["profile-rustflags", "trim-paths"]
2
+
3
+ [package]
4
+ name = "cursor-api"
5
+ version = "0.3.6-2"
6
+ edition = "2024"
7
+ authors = ["wisdgod <nav@wisdgod.com>"]
8
+ description = "OpenAI format compatibility layer for the Cursor API"
9
+ license = "MIT OR Apache-2.0"
10
+ repository = "https://github.com/wisdgod/cursor-api"
11
+
12
+ [[bin]]
13
+ name = "cursor-api"
14
+ path = "src/main.rs"
15
+
16
+ # [[bin]]
17
+ # name = "rkyv-adapter"
18
+ # path = "tools/rkyv_adapter/src/main.rs"
19
+
20
+ [build-dependencies]
21
+ chrono = { version = "0.4", default-features = false, features = ["alloc"]}
22
+ prost-build = { version = "0.14", optional = true }
23
+ sha2 = { version = "0.10", default-features = false }
24
+ serde_json = "1"
25
+
26
+ [dependencies]
27
+ ahash = { version = "0.8", default-features = false, features = ["std", "compile-time-rng", "serde"] }
28
+ arc-swap = "1"
29
+ axum = { version = "0.8", default-features = false, features = ["http1", "http2", "json", "tokio", "query", "macros"] }
30
+ # base62 = "2.2.1"
31
+ base64 = { version = "0.22", default-features = false, features = ["std"] }
32
+ # bs58 = { version = "0.5.1", default-features = false, features = ["std"] }
33
+ # brotli = { version = "7.0", default-features = false, features = ["std"] }
34
+ bytes = "1.10"
35
+ chrono = { version = "0.4", default-features = false, features = ["alloc", "serde", "rkyv-64"] }
36
+ chrono-tz = { version = "0.10", features = ["serde"] }
37
+ dotenvy = "0.15"
38
+ flate2 = { version = "1", default-features = false, features = ["rust_backend"] }
39
+ futures = { version = "0.3", default-features = false, features = ["std"] }
40
+ gif = { version = "0.13", default-features = false, features = ["std"] }
41
+ hashbrown = { version = "0.15", default-features = false }
42
+ hex = { version = "0.4", default-features = false, features = ["std"] }
43
+ http = "1"
44
+ http-body-util = "0.1"
45
+ image = { version = "0.25", default-features = false, features = ["jpeg", "png", "gif", "webp"] }
46
+ # lasso = { version = "0.7", features = ["multi-threaded", "ahasher"] }
47
+ memmap2 = "0.9"
48
+ # openssl = { version = "0.10", features = ["vendored"] }
49
+ parking_lot = "0.12"
50
+ paste = "1.0"
51
+ phf = { version = "0.12", features = ["macros"] }
52
+ # pin-project-lite = "0.2"
53
+ # pin-project = "1"
54
+ prost = "0.14"
55
+ prost-types = "0.14"
56
+ rand = { version = "0.9", default-features = false, features = ["thread_rng"] }
57
+ reqwest = { version = "0.12", default-features = false, features = ["gzip", "brotli", "json", "stream", "socks", "charset", "http2", "macos-system-configuration"] }
58
+ rkyv = { version = "0.8", default-features = false, features = ["std", "pointer_width_64", "uuid-1"] }
59
+ # rustls = { version = "0.23.26", default-features = false, features = ["std", "tls12"] }
60
+ serde = { version = "1", default-features = false, features = ["std", "derive", "rc"] }
61
+ # serde_json = { package = "sonic-rs", version = "0" }
62
+ serde_json = "1"
63
+ sha2 = { version = "0", default-features = false }
64
+ sysinfo = { version = "0.37", default-features = false, features = ["system"] }
65
+ tokio = { version = "1", features = ["rt-multi-thread", "macros", "net", "sync", "time", "fs", "signal"] }
66
+ tokio-util = { version = "0.7", features = ["io"] }
67
+ # tokio-tungstenite = { version = "0.26.2", features = ["rustls-tls-webpki-roots"] }
68
+ # tokio-stream = { version = "0.1", features = ["time"] }
69
+ tower-http = { version = "0.6", features = ["cors", "limit"] }
70
+ tracing = { version = "*", default-features = false, features = ["max_level_off", "release_max_level_off"] }
71
+ ulid = { version = "1.2", default-features = false, features = ["std", "rkyv"] }
72
+ # tracing-subscriber = "0.3"
73
+ url = { version = "2.5", default-features = false, features = ["serde"] }
74
+ uuid = { version = "1.14", default-features = false, features = ["v4", "fast-rng", "serde"] }
75
+
76
+ [profile.dev]
77
+ debug = "line-tables-only"
78
+
79
+ [profile.release]
80
+ lto = true
81
+ codegen-units = 1
82
+ panic = 'abort'
83
+ strip = true
84
+ # debug = true
85
+ # split-debuginfo = 'packed'
86
+ # strip = "none"
87
+ # panic = 'unwind'
88
+ opt-level = 3
89
+ trim-paths = "all"
90
+ rustflags = ["-Cdebuginfo=0", "-Zthreads=8"]
91
+
92
+ [features]
93
+ default = ["webpki-roots"]
94
+ webpki-roots = ["reqwest/rustls-tls-webpki-roots"]
95
+ native-roots = ["reqwest/rustls-tls-native-roots"]
96
+ use-minified = []
97
+ __preview = []
98
+ __protoc = ["prost-build"]
99
+ __compat = []
100
+
101
+ [patch.crates-io]
102
+ h2 = { path = "patch/h2-0.4.10" }
103
+ reqwest = { path = "patch/reqwest-0.12.18" }
104
+ rustls = { path = "patch/rustls-0.23.28" }
105
+ chrono = { path = "patch/chrono-0.4.41" }
106
+ ulid = { path = "patch/ulid-1.2.1" }
107
+ dotenvy = { path = "patch/dotenvy-0.15.7" }
108
+ # bs58 = { path = "patch/bs58-0.5.1" }
109
+ # base62 = { path = "patch/base62-2.2.1" }