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