bohesocool commited on
Commit
f6fa966
·
verified ·
1 Parent(s): 30d331e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +60 -24
Dockerfile CHANGED
@@ -1,33 +1,69 @@
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"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:19.1.0-alpine3.16
 
2
 
3
+ # Arguments
4
+ ARG APP_HOME=/home/node/app
5
 
6
+ # Install system dependencies
7
+ RUN apk add gcompat tini git jq curl
8
 
9
+ # Ensure proper handling of kernel signals
10
+ ENTRYPOINT [ "tini", "--" ]
11
 
12
+ # Create app directory
13
+ WORKDIR ${APP_HOME}
14
 
15
+ # Set NODE_ENV to production
16
+ ENV NODE_ENV=production
17
 
18
+ # Env
19
+ # 是否远程获取下面的参数 是个链接,返回一个json;执行完后关闭这个链接即可保密
20
+ # 返回内容:
21
+ # {
22
+ # "reverse_proxy": "https://onekey.xxx.top/v1",
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
+ # Install app dependencies
32
+ # COPY package*.json post-install.js ./
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
+ # Bundle app source
39
+ # COPY . ./
 
40
 
41
+ ADD launch.sh launch.sh
42
+ RUN curl -JLO https://github.com/bincooo/SillyTavern-Docker/releases/download/v1.0.0/git-batch
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" ]