hmtxj commited on
Commit
b98578f
·
verified ·
1 Parent(s): 25b0c29

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -6
Dockerfile CHANGED
@@ -1,12 +1,17 @@
1
- FROM ghcr.io/hmtxj/new-api:latest
2
 
3
- # HF Spaces 使用 7860 端口
4
- ENV PORT=7860
 
 
 
5
 
6
- # 数据目录
7
- VOLUME /data
 
8
 
 
 
9
  EXPOSE 7860
10
 
11
- # 启动命令
12
  CMD ["./new-api", "--port", "7860"]
 
1
+ FROM golang:1.21-alpine AS builder
2
 
3
+ WORKDIR /app
4
+ COPY . .
5
+ RUN go build -o new-api .
6
+
7
+ FROM alpine:latest
8
 
9
+ WORKDIR /app
10
+ COPY --from=builder /app/new-api .
11
+ COPY --from=builder /app/web ./web
12
 
13
+ # HF Spaces 使用 7860 端口
14
+ ENV PORT=7860
15
  EXPOSE 7860
16
 
 
17
  CMD ["./new-api", "--port", "7860"]