File size: 3,215 Bytes
d6686c9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
674040f
d6686c9
de3e5a6
d6686c9
 
 
320debb
d6686c9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
FROM node:19.1.0-alpine3.16

# Arguments
ARG APP_HOME=/home/node/app

# Install system dependencies
RUN apk add gcompat tini git jq curl

# Ensure proper handling of kernel signals
ENTRYPOINT [ "tini", "--" ]

# Create app directory
WORKDIR ${APP_HOME}

# Env
# 是否远程获取下面的参数 是个链接,返回一个json;执行完后关闭这个链接即可保密
# 返回内容:
#  {
#    "reverse_proxy": "https://onekey.xxx.top/v1",
#    "proxy_password": "sk-ssvJn4VQAk596Lvv3548xxx",
#    "api_key_makersuite": "AIzaSyAm5S9kl22DDNSXmnd4vgxxx",
#    "github_secret": "github_pat_11AIWDQ2A0cLSEdwiwiZNC_10II4TsFExxx",
#    "github_project": "bincooo/history"
#  }
ENV fetch ""
# 代理转发地址
ENV reverse_proxy ""
# 代理转发token
ENV proxy_password ""
# gemini token
ENV api_key_makersuite ""
# github 项目访问凭证token
ENV github_secret "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"
# github 项目名称
ENV github_project "songdaopi/cache"

# Install app dependencies
# COPY package*.json post-install.js ./
RUN git clone https://github.com/SillyTavern/SillyTavern.git --branch 1.12.1 .
RUN \
  echo "*** Install npm packages ***" && \
  npm install && npm cache clean --force

# Bundle app source
# COPY . ./

ADD auto.sh auto.sh
RUN curl -JLO https://github.com/bincooo/SillyTavern-Docker/releases/download/v1.0.0/git-batch
RUN chmod +x auto.sh && chmod +x git-batch


# Copy default chats, characters and user avatars to <folder>.default folder
RUN \
  IFS="," RESOURCES="assets,backgrounds,user,context,instruct,QuickReplies,movingUI,themes,characters,chats,groups,group chats,User Avatars,worlds,OpenAI Settings,NovelAI Settings,KoboldAI Settings,TextGen Settings" && \
  \
  echo "*** Store default $RESOURCES in <folder>.default ***" && \
  for R in $RESOURCES; do mv "public/$R" "public/$R.default"; done || true && \
  \
  echo "*** Create symbolic links to config directory ***" && \
  for R in $RESOURCES; do ln -s "../config/$R" "public/$R"; done || true && \
  \
  rm -f "config.yaml" "public/settings.json" || true && \
  ln -s "./config/config.yaml" "config.yaml" || true && \
  ln -s "../config/settings.json" "public/settings.json" || true && \
  mkdir "config" || true && \
  mkdir -p "public/user" || true
  #\
  #for R in $RESOURCES; do mkdir "config/$R"; done || true

ADD ["user-default.png", "config/User Avatars/user-default.png"]
ADD ["OpenAI Settings", "config/OpenAI Settings"]
ADD ["QuickReplies", "config/QuickReplies"]
ADD secrets.json secrets.json
# 启动设置
ADD config.yaml config/config.yaml
# 服务设置
ADD settings.json config/settings.json
# 导入角色卡
ADD characters config/characters


# Cleanup unnecessary files
RUN \
  echo "*** Cleanup ***" && \
  mv "./docker/docker-entrypoint.sh" "./" && \
  rm -rf "./docker" && \
  echo "*** Make docker-entrypoint.sh executable ***" && \
  chmod +x "./docker-entrypoint.sh" && \
  echo "*** Convert line endings to Unix format ***" && \
  dos2unix "./docker-entrypoint.sh"
RUN sed -i 's/# Start the server/.\/auto.sh env \&\& .\/auto.sh init/g' docker-entrypoint.sh
RUN chmod -R 777 ${APP_HOME}

EXPOSE 8000

CMD [ "./docker-entrypoint.sh" ]