Update Dockerfile
Browse files- Dockerfile +7 -7
Dockerfile
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
FROM golang:1.21-alpine AS builder
|
2 |
-
|
3 |
WORKDIR /app
|
4 |
RUN apk add git make && git clone https://github.com/bincooo/chatgpt-adapter.git .
|
5 |
RUN make build-linux
|
6 |
-
|
|
|
|
|
7 |
FROM alpine:3.19.0
|
8 |
WORKDIR /app
|
9 |
COPY --from=builder /app/bin/linux/server ./server
|
10 |
COPY --from=builder /app/bin/config.yaml ./config.yaml
|
11 |
-
|
|
|
12 |
RUN mkdir -p /app/log && chmod 777 /app/log
|
13 |
ENV PORT 7860
|
14 |
-
|
15 |
# 安装curl用于保持活跃
|
16 |
RUN apk add --no-cache curl
|
17 |
-
|
18 |
-
|
19 |
-
CMD ["sh", "-c", "./server --port $PORT & while true; do curl -s http://localhost:$PORT > /dev/null; sleep 1800; done"]
|
|
|
1 |
FROM golang:1.21-alpine AS builder
|
|
|
2 |
WORKDIR /app
|
3 |
RUN apk add git make && git clone https://github.com/bincooo/chatgpt-adapter.git .
|
4 |
RUN make build-linux
|
5 |
+
# 编译代理服务器
|
6 |
+
COPY proxy.go .
|
7 |
+
RUN go build -o proxy proxy.go
|
8 |
FROM alpine:3.19.0
|
9 |
WORKDIR /app
|
10 |
COPY --from=builder /app/bin/linux/server ./server
|
11 |
COPY --from=builder /app/bin/config.yaml ./config.yaml
|
12 |
+
COPY --from=builder /app/proxy ./proxy
|
13 |
+
RUN chmod +x server proxy
|
14 |
RUN mkdir -p /app/log && chmod 777 /app/log
|
15 |
ENV PORT 7860
|
|
|
16 |
# 安装curl用于保持活跃
|
17 |
RUN apk add --no-cache curl
|
18 |
+
# 启动代理服务器并保持活跃
|
19 |
+
CMD ["sh", "-c", "./proxy & while true; do curl -s http://localhost:$PORT > /dev/null; sleep 1800; done"]
|
|