Upload 2 files
Browse files- Dockerfile +49 -0
- README.md +12 -0
Dockerfile
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM node:18-alpine
|
| 2 |
+
|
| 3 |
+
# 安装必要的工具
|
| 4 |
+
RUN apk add --no-cache git shadow
|
| 5 |
+
|
| 6 |
+
# 克隆酒馆的代码
|
| 7 |
+
RUN git clone https://github.com/SillyTavern/SillyTavern.git /app
|
| 8 |
+
|
| 9 |
+
WORKDIR /app
|
| 10 |
+
|
| 11 |
+
# 安装依赖
|
| 12 |
+
RUN npm install --only=production
|
| 13 |
+
|
| 14 |
+
# ==========================================
|
| 15 |
+
# 🛡️ 注入防伪防盗版前端遮罩(云端安全兼容版)
|
| 16 |
+
# ==========================================
|
| 17 |
+
# 使用 base64 编码注入动态脚本,完美绕过云端 Worker、Docker 的任何特殊字符过滤与转义问题!
|
| 18 |
+
RUN echo "const runAntiPiracy = () => { \
|
| 19 |
+
if (localStorage.getItem('hide_anti_piracy')) return; \
|
| 20 |
+
const layer = document.createElement('div'); \
|
| 21 |
+
layer.id = 'anti-piracy-layer'; \
|
| 22 |
+
layer.style = 'position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.85);z-index:999999;display:flex;justify-content:center;align-items:center;backdrop-filter:blur(5px);color:white;font-family:sans-serif;text-align:center;'; \
|
| 23 |
+
layer.innerHTML = \`<div style=\"background:#222;padding:30px;border-radius:12px;box-shadow:0 8px 32px rgba(0,0,0,0.5);max-width:450px;border:1px solid #ff4d4d;\"><h2 style=\"color:#ff4d4d;margin-top:0;\">⚠️ 免费开源防伪声明</h2><p style=\"font-size:14px;line-height:1.6;text-align:left;\">本项目由 <b>GitHub @bainiao0706</b> 倾心免费开源!<br>官方地址: <a href=\"https://github.com/bainiao0706/-sillytavern-\" target=\"_blank\" style=\"color:#4da6ff;text-decoration:none;\">github.com/bainiao0706/-sillytavern-</a><br><br><b>【严厉警告】</b><br>本项目完全免费!任何在闲鱼、淘宝、付费社群内向您收费贩卖此教程或代搭建服务的行为,均属于<b>欺诈盗用</b>!请立刻投诉并向平台申请退款!</p><div style=\"display:flex;gap:10px;justify-content:center;margin-top:15px;\"><button id=\"btn-go-git\" style=\"background:#4da6ff;color:white;border:none;padding:10px 16px;font-size:14px;border-radius:6px;cursor:pointer;font-weight:bold;\">去GitHub仓库</button><button id=\"btn-close-once\" style=\"background:#666;color:white;border:none;padding:10px 16px;font-size:14px;border-radius:6px;cursor:pointer;font-weight:bold;\">直接进入</button><button id=\"btn-never-show\" style=\"background:#ff4d4d;color:white;border:none;padding:10px 16px;font-size:14px;border-radius:6px;cursor:pointer;font-weight:bold;\">不再提示</button></div></div>\`; \
|
| 24 |
+
document.body.appendChild(layer); \
|
| 25 |
+
document.getElementById('btn-go-git').onclick = () => window.open('https://github.com/bainiao0706/-sillytavern-', '_blank'); \
|
| 26 |
+
document.getElementById('btn-close-once').onclick = () => layer.remove(); \
|
| 27 |
+
document.getElementById('btn-never-show').onclick = () => { localStorage.setItem('hide_anti_piracy', 'true'); layer.remove(); }; \
|
| 28 |
+
}; \
|
| 29 |
+
if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', runAntiPiracy); } else { runAntiPiracy(); }" > /app/anti-piracy.js && \
|
| 30 |
+
sed -i 's|</body>|<script src="./anti-piracy.js"></script></body>|g' /app/public/index.html
|
| 31 |
+
|
| 32 |
+
ENV BACKGROUND_COLOR=black
|
| 33 |
+
ENV NODE_ENV=production
|
| 34 |
+
|
| 35 |
+
# 写入配置,使用时修改用户名和密码
|
| 36 |
+
RUN printf "port: 7860\n\
|
| 37 |
+
listen: true\n\
|
| 38 |
+
whitelistMode: false\n\
|
| 39 |
+
basicAuthMode: true\n\
|
| 40 |
+
basicAuthUser:\n\
|
| 41 |
+
username: \"root\"\n\
|
| 42 |
+
password: \"admin\"\n\
|
| 43 |
+
trustProxy: true\n" > config.yaml
|
| 44 |
+
|
| 45 |
+
# 端口号
|
| 46 |
+
EXPOSE 7860
|
| 47 |
+
|
| 48 |
+
# 酒馆,启动!
|
| 49 |
+
CMD ["node", "server.js"]
|
README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: st #修改为你在hugging face创建实例的名字
|
| 3 |
+
emoji: 🎭
|
| 4 |
+
colorFrom: purple
|
| 5 |
+
colorTo: indigo
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_port: 7860
|
| 8 |
+
storage_spaces:
|
| 9 |
+
- /app/data
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
SillyTavern on Hugging Face Spaces.
|