sarkyboy commited on
Commit
585c2f2
·
1 Parent(s): 459f994

debug: build from source with deep logging

Browse files
Files changed (1) hide show
  1. Dockerfile +29 -9
Dockerfile CHANGED
@@ -1,16 +1,36 @@
1
- FROM eceasy/cli-proxy-api:latest
2
 
3
- # 创建数据目录并赋予权限(HF Spaces 容器以 UID 1000 运行)
4
- RUN mkdir -p /CLIProxyAPI/auth /CLIProxyAPI/logs && \
5
- chmod -R 777 /CLIProxyAPI/auth /CLIProxyAPI/logs
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
- # 复制配置文件和启动脚本
8
  COPY config.yaml /CLIProxyAPI/config.yaml
9
  COPY entrypoint.sh /CLIProxyAPI/entrypoint.sh
10
- RUN chmod +x /CLIProxyAPI/entrypoint.sh
11
 
12
- # HF Spaces 只暴露一个端口
13
- EXPOSE 8317
 
 
 
 
 
 
 
 
14
 
15
- # 使用自定义入口点,运行时注入环境变量到 config.yaml
16
  ENTRYPOINT ["/CLIProxyAPI/entrypoint.sh"]
 
1
+ FROM golang:1.22-alpine AS builder
2
 
3
+ WORKDIR /app
4
+ COPY src/ .
5
+ # Download dependencies
6
+ RUN go mod download
7
+ # Build the application
8
+ RUN go build -o CLIProxyAPI cmd/cli-proxy-api/main.go
9
+
10
+ # Final stage
11
+ FROM alpine:latest
12
+
13
+ WORKDIR /CLIProxyAPI
14
+
15
+ # Copy binary from builder
16
+ COPY --from=builder /app/CLIProxyAPI /CLIProxyAPI/CLIProxyAPI
17
+ # Copy config example as fallback (though entrypoint uses config.yaml)
18
+ COPY --from=builder /app/config.example.yaml /CLIProxyAPI/config.example.yaml
19
 
20
+ # Copy local config and entrypoint
21
  COPY config.yaml /CLIProxyAPI/config.yaml
22
  COPY entrypoint.sh /CLIProxyAPI/entrypoint.sh
 
23
 
24
+ # Create necessary directories
25
+ RUN mkdir -p /CLIProxyAPI/auth /CLIProxyAPI/logs && \
26
+ chmod 777 /CLIProxyAPI/auth /CLIProxyAPI/logs && \
27
+ chmod +x /CLIProxyAPI/entrypoint.sh
28
+
29
+ # Expose port
30
+ EXPOSE 8080
31
+
32
+ # Volumes for persistence
33
+ VOLUME ["/CLIProxyAPI/auth", "/CLIProxyAPI/logs"]
34
 
35
+ # Set entrypoint
36
  ENTRYPOINT ["/CLIProxyAPI/entrypoint.sh"]