eggacheb commited on
Commit
9abf3a4
1 Parent(s): 53aaca6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +50 -66
Dockerfile CHANGED
@@ -1,3 +1,4 @@
 
1
  FROM node:19.1.0-alpine3.16
2
 
3
  # Arguments
@@ -11,98 +12,81 @@ ENTRYPOINT [ "tini", "--" ]
11
 
12
  # Create app directory
13
  WORKDIR ${APP_HOME}
14
- RUN mkdir -p /app/config/
15
- RUN mkdir -p /app/public/
16
- RUN mkdir -p /app/public/user
17
- RUN mkdir -p /app/config/User Avatars/
18
- RUN mkdir -p /app/config/User Avatars/
19
 
20
- RUN chmod -R 777 /app/config/
21
- RUN chmod -R 777 /app/public/
22
- RUN chmod -R 777 /app/public/user
23
- RUN chmod -R 777 /app/public/$R
24
- RUN chmod -R 777 /app/public/$R
25
-
26
-
27
- # Env
28
- # 是否远程获取下面的参数 是个链接,返回一个json;执行完后关闭这个链接即可保密
29
- # 返回内容:
30
- # {
31
- # "reverse_proxy": "https://onekey.xxx.top/v1",
32
- # "proxy_password": "sk-ssvJn4VQAk596Lvv3548xxx",
33
- # "api_key_makersuite": "AIzaSyAm5S9kl22DDNSXmnd4vgxxx",
34
- # "github_secret": "github_pat_11AIWDQ2A0cLSEdwiwiZNC_10II4TsFExxx",
35
- # "github_project": "bincooo/history"
36
- # }
37
  ENV fetch ""
38
- # 代理转发地址
39
  ENV reverse_proxy ""
40
- # 代理转发token
41
  ENV proxy_password ""
42
- # gemini token
43
  ENV api_key_makersuite ""
44
- # github 项目访问凭证token
45
  ENV github_secret ""
46
- # github 项目名称
47
  ENV github_project ""
48
 
 
 
 
 
 
 
 
49
  # Install app dependencies
50
- # COPY package*.json post-install.js ./
51
- RUN git clone https://github.com/SillyTavern/SillyTavern.git --branch 1.11.7
52
- RUN \
53
- echo "*** Install npm packages ***" && \
54
- npm install && npm cache clean --force
55
 
56
- # Bundle app source
57
- # COPY . ./
58
 
 
59
  ADD auto.sh auto.sh
60
  RUN curl -JLO https://github.com/bincooo/SillyTavern-Docker/releases/download/v1.0.0/git-batch
61
  RUN chmod +x auto.sh && chmod +x git-batch
62
 
63
-
64
  # Copy default chats, characters and user avatars to <folder>.default folder
65
- RUN \
66
- 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" && \
67
- \
68
- echo "*** Store default $RESOURCES in <folder>.default ***" && \
69
- for R in $RESOURCES; do mv "public/$R" "public/$R.default"; done || true && \
70
- \
71
- echo "*** Create symbolic links to config directory ***" && \
72
- for R in $RESOURCES; do ln -s "../config/$R" "public/$R"; done || true && \
73
- \
74
- rm -f "config.yaml" "public/settings.json" || true && \
75
- ln -s "./config/config.yaml" "config.yaml" || true && \
76
- ln -s "../config/settings.json" "public/settings.json" || true && \
77
- mkdir "config" || true && \
78
- mkdir -p "public/user" || true
79
- #\
80
- #for R in $RESOURCES; do mkdir "config/$R"; done || true
81
-
82
  ADD ["user-default.png", "config/User Avatars/user-default.png"]
83
  ADD ["OpenAI Settings", "config/OpenAI Settings"]
84
  ADD ["QuickReplies", "config/QuickReplies"]
85
  ADD secrets.json secrets.json
86
- # 启动设置
87
  ADD config.yaml config/config.yaml
88
- # 服务设置
89
  ADD settings.json config/settings.json
90
- # 导入角色卡
91
  ADD characters config/characters
92
 
93
-
94
  # Cleanup unnecessary files
95
- RUN \
96
- echo "*** Cleanup ***" && \
97
- mv "./docker/docker-entrypoint.sh" "./" && \
98
- rm -rf "./docker" && \
99
- echo "*** Make docker-entrypoint.sh executable ***" && \
100
- chmod +x "./docker-entrypoint.sh" && \
101
- echo "*** Convert line endings to Unix format ***" && \
102
- dos2unix "./docker-entrypoint.sh"
103
  RUN sed -i 's/# Start the server/.\/auto.sh env \&\& .\/auto.sh init/g' docker-entrypoint.sh
104
- RUN chmod -R 777 ${APP_HOME}
105
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  EXPOSE 8000
107
 
108
- CMD [ "./docker-entrypoint.sh" ]
 
 
1
+ # Pull the base image
2
  FROM node:19.1.0-alpine3.16
3
 
4
  # Arguments
 
12
 
13
  # Create app directory
14
  WORKDIR ${APP_HOME}
 
 
 
 
 
15
 
16
+ # Set environment variables
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  ENV fetch ""
 
18
  ENV reverse_proxy ""
 
19
  ENV proxy_password ""
 
20
  ENV api_key_makersuite ""
 
21
  ENV github_secret ""
 
22
  ENV github_project ""
23
 
24
+ # Create necessary directories and set permissions
25
+ RUN mkdir -p ${APP_HOME}/config/User\ Avatars \
26
+ ${APP_HOME}/public/user && \
27
+ chmod -R 777 ${APP_HOME}/config \
28
+ ${APP_HOME}/public \
29
+ ${APP_HOME}/public/user
30
+
31
  # Install app dependencies
32
+ RUN git clone https://github.com/SillyTavern/SillyTavern.git --branch 1.11.7 ${APP_HOME}/SillyTavern
33
+ WORKDIR ${APP_HOME}/SillyTavern
34
+ RUN echo "*** Install npm packages ***" && \
35
+ npm install && npm cache clean --force
 
36
 
37
+ # Return to app directory
38
+ WORKDIR ${APP_HOME}
39
 
40
+ # Bundle app source
41
  ADD auto.sh auto.sh
42
  RUN curl -JLO https://github.com/bincooo/SillyTavern-Docker/releases/download/v1.0.0/git-batch
43
  RUN chmod +x auto.sh && chmod +x git-batch
44
 
 
45
  # Copy default chats, characters and user avatars to <folder>.default folder
46
+ 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" && \
47
+ echo "*** Store default $RESOURCES in <folder>.default ***" && \
48
+ for R in $RESOURCES; do mv "public/$R" "public/$R.default"; done || true && \
49
+ echo "*** Create symbolic links to config directory ***" && \
50
+ for R in $RESOURCES; do ln -s "../config/$R" "public/$R"; done || true && \
51
+ rm -f "config.yaml" "public/settings.json" || true && \
52
+ ln -s "./config/config.yaml" "config.yaml" || true && \
53
+ ln -s "../config/settings.json" "public/settings.json" || true && \
54
+ mkdir -p "config" "public/user"
55
+
56
+ # Add necessary files
 
 
 
 
 
 
57
  ADD ["user-default.png", "config/User Avatars/user-default.png"]
58
  ADD ["OpenAI Settings", "config/OpenAI Settings"]
59
  ADD ["QuickReplies", "config/QuickReplies"]
60
  ADD secrets.json secrets.json
 
61
  ADD config.yaml config/config.yaml
 
62
  ADD settings.json config/settings.json
 
63
  ADD characters config/characters
64
 
 
65
  # Cleanup unnecessary files
66
+ RUN echo "*** Cleanup ***" && \
67
+ mv "./docker/docker-entrypoint.sh" "./" && \
68
+ rm -rf "./docker" && \
69
+ echo "*** Make docker-entrypoint.sh executable ***" && \
70
+ chmod +x "./docker-entrypoint.sh" && \
71
+ echo "*** Convert line endings to Unix format ***" && \
72
+ dos2unix "./docker-entrypoint.sh"
 
73
  RUN sed -i 's/# Start the server/.\/auto.sh env \&\& .\/auto.sh init/g' docker-entrypoint.sh
 
74
 
75
+ # Create necessary directories and set permissions
76
+ RUN mkdir -p /app/uploads/temp \
77
+ /app/client/public/images/temp \
78
+ /app/api/logs/ \
79
+ /app/api/data/ \
80
+ /app/data && \
81
+ chmod -R 777 /app/uploads/temp \
82
+ /app/client/public/images \
83
+ /app/api/logs/ \
84
+ /app/api/data/ \
85
+ /app/data \
86
+ ${APP_HOME}
87
+
88
+ # Expose port
89
  EXPOSE 8000
90
 
91
+ # Command to run on container start
92
+ CMD [ "./docker-entrypoint.sh" ]