Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +24 -60
Dockerfile
CHANGED
@@ -1,69 +1,33 @@
|
|
1 |
-
|
|
|
2 |
|
3 |
-
#
|
4 |
-
|
5 |
|
6 |
-
#
|
7 |
-
|
8 |
|
9 |
-
#
|
10 |
-
|
11 |
|
12 |
-
#
|
13 |
-
|
14 |
|
15 |
-
#
|
16 |
-
|
17 |
|
18 |
-
#
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
# "proxy_password": "sk-ssvJn4VQAk596Lvv3548xxx",
|
24 |
-
# "api_key_makersuite": "AIzaSyAm5S9kl22DDNSXmnd4vgxxx",
|
25 |
-
# "github_secret": "github_pat_11AIWDQ2A0cLSEdwiwiZNC_10II4TsFExxx",
|
26 |
-
# "github_project": "bincooo/history"
|
27 |
-
# }
|
28 |
-
ENV fetch ""
|
29 |
-
ENV api_key_makersuite ""
|
30 |
|
31 |
-
#
|
32 |
-
|
33 |
-
RUN git clone https://github.com/SillyTavern/SillyTavern.git --branch 1.12.7 .
|
34 |
-
RUN \
|
35 |
-
echo "*** Install npm packages ***" && \
|
36 |
-
npm install && npm cache clean --force
|
37 |
|
38 |
-
#
|
39 |
-
|
|
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
RUN chmod +x launch.sh && chmod +x git-batch && ./git-batch -h
|
44 |
-
|
45 |
-
RUN \
|
46 |
-
echo "*** Install npm packages ***" && \
|
47 |
-
npm i --no-audit --no-fund --loglevel=error --no-progress --omit=dev && npm cache clean --force
|
48 |
-
|
49 |
-
# Copy default chats, characters and user avatars to <folder>.default folder
|
50 |
-
RUN \
|
51 |
-
rm -f "config.yaml" || true && \
|
52 |
-
ln -s "./config/config.yaml" "config.yaml" || true && \
|
53 |
-
mkdir "config" || true
|
54 |
-
|
55 |
-
# Cleanup unnecessary files
|
56 |
-
RUN \
|
57 |
-
echo "*** Cleanup ***" && \
|
58 |
-
mv "./docker/docker-entrypoint.sh" "./" && \
|
59 |
-
rm -rf "./docker" && \
|
60 |
-
echo "*** Make docker-entrypoint.sh executable ***" && \
|
61 |
-
chmod +x "./docker-entrypoint.sh" && \
|
62 |
-
echo "*** Convert line endings to Unix format ***" && \
|
63 |
-
dos2unix "./docker-entrypoint.sh"
|
64 |
-
RUN sed -i 's/# Start the server/.\/launch.sh env \&\& .\/launch.sh init/g' docker-entrypoint.sh
|
65 |
-
RUN chmod -R 777 ${APP_HOME}
|
66 |
-
|
67 |
-
EXPOSE 8000
|
68 |
-
|
69 |
-
CMD [ "./docker-entrypoint.sh" ]
|
|
|
1 |
+
# 使用最新的 Go 1.22 版本作为基础镜像
|
2 |
+
FROM golang:1.22-alpine
|
3 |
|
4 |
+
# 安装必要的系统依赖
|
5 |
+
RUN apk --no-cache add ca-certificates git curl
|
6 |
|
7 |
+
# 设置工作目录
|
8 |
+
WORKDIR /app
|
9 |
|
10 |
+
# 克隆项目代码
|
11 |
+
RUN git clone https://github.com/bohesocool/you2api.git .
|
12 |
|
13 |
+
# 下载依赖
|
14 |
+
RUN go mod download
|
15 |
|
16 |
+
# 构建应用
|
17 |
+
RUN CGO_ENABLED=0 GOOS=linux GODEBUG=http2debug=2 go build -o main .
|
18 |
|
19 |
+
# 设置环境变量
|
20 |
+
ENV PORT=8080
|
21 |
+
ENV ENABLE_PROXY=true
|
22 |
+
ENV PROXY_URL=""
|
23 |
+
ENV PROXY_TIMEOUT_MS=5000
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
+
# 暴露端口
|
26 |
+
EXPOSE 8080
|
|
|
|
|
|
|
|
|
27 |
|
28 |
+
# 添加健康检查
|
29 |
+
HEALTHCHECK --interval=30s --timeout=3s \
|
30 |
+
CMD curl -f 0.0.0.0:8080/ || exit 1
|
31 |
|
32 |
+
# 运行应用并输出更多日志
|
33 |
+
CMD ["sh", "-c", "echo '启动服务...' && GODEBUG=http2debug=2 ./main"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|