Skip to content

Commit 3d59ea7

Browse files
committed
Refactor Docker setup for unified multimodel build
Updated Dockerfile to build a single 'factory-proxy' binary from 'main_multimodel.go' and copy additional config and documentation files. Updated docker-compose.yml to set new environment variables (FACTORY_API_KEY, PROXY_API_KEY, CONFIG_PATH) and removed references to the old 'factory-proxy-openai' binary. This streamlines the build and deployment process for multimodel support.
1 parent 22c3fef commit 3d59ea7

2 files changed

Lines changed: 21 additions & 10 deletions

File tree

Dockerfile

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@ COPY go.mod go.sum ./
1616
RUN go mod download && go mod verify
1717

1818
# 复制源代码
19-
COPY main.go main-openai.go ./
19+
COPY main_multimodel.go ./
20+
COPY config/ ./config/
21+
COPY transformers/ ./transformers/
22+
COPY config.json ./
23+
COPY docs.html ./
2024

21-
# 构建两个版本
22-
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o factory-proxy main.go
23-
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o factory-proxy-openai main-openai.go
25+
# 构建应用
26+
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o factory-proxy main_multimodel.go
2427

2528
# 第二阶段:运行(Anthropic 原生模式)
2629
FROM alpine:latest AS anthropic
@@ -34,8 +37,10 @@ RUN addgroup -g 1000 app && \
3437

3538
WORKDIR /app
3639

37-
# 从构建阶段复制二进制文件
40+
# 从构建阶段复制二进制文件和配置文件
3841
COPY --from=builder /build/factory-proxy .
42+
COPY --from=builder /build/config.json .
43+
COPY --from=builder /build/docs.html .
3944

4045
# 设置文件权限
4146
RUN chown -R app:app /app
@@ -65,8 +70,10 @@ RUN addgroup -g 1000 app && \
6570

6671
WORKDIR /app
6772

68-
# 从构建阶段复制二进制文件
69-
COPY --from=builder /build/factory-proxy-openai .
73+
# 从构建阶段复制二进制文件和配置文件
74+
COPY --from=builder /build/factory-proxy .
75+
COPY --from=builder /build/config.json .
76+
COPY --from=builder /build/docs.html .
7077

7178
# 设置文件权限
7279
RUN chown -R app:app /app
@@ -82,4 +89,4 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
8289
CMD wget --no-verbose --tries=1 --spider http://localhost:8003/v1/health || exit 1
8390

8491
# 启动命令
85-
ENTRYPOINT ["./factory-proxy-openai"]
92+
ENTRYPOINT ["./factory-proxy"]

docker-compose.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ services:
1111
- "8001:8000"
1212
environment:
1313
- PORT=8000
14-
- ANTHROPIC_TARGET_URL=${ANTHROPIC_TARGET_URL:-https://gibuoilncyzqebelqjqz.supabase.co/functions/v1/smooth-handler/https://app.factory.ai/api/llm/a/v1/messages}
14+
- FACTORY_API_KEY=${FACTORY_API_KEY}
15+
- PROXY_API_KEY=${PROXY_API_KEY}
16+
- CONFIG_PATH=config.json
1517
restart: unless-stopped
1618
healthcheck:
1719
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8000/health"]
@@ -32,7 +34,9 @@ services:
3234
- "8003:8003"
3335
environment:
3436
- PORT=8003
35-
- ANTHROPIC_TARGET_URL=${ANTHROPIC_TARGET_URL:-https://gibuoilncyzqebelqjqz.supabase.co/functions/v1/smooth-handler/https://app.factory.ai/api/llm/a/v1/messages}
37+
- FACTORY_API_KEY=${FACTORY_API_KEY}
38+
- PROXY_API_KEY=${PROXY_API_KEY}
39+
- CONFIG_PATH=config.json
3640
restart: unless-stopped
3741
healthcheck:
3842
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8003/v1/health"]

0 commit comments

Comments
 (0)