ssx47 commited on
Commit
6ede8ad
·
verified ·
1 Parent(s): e8afec9

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile +51 -0
  2. config.template.yaml +99 -0
  3. entrypoint.sh +15 -0
Dockerfile ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Base image
2
+ FROM ghcr.io/yu2051/jiuguan002:latest
3
+
4
+ # Switch to root user to install tools and prepare the filesystem
5
+ USER root
6
+
7
+ # 1. Install 'gettext' and 'git'.
8
+ RUN apk add --no-cache gettext git
9
+
10
+ # 2. Create the data directory.
11
+ RUN mkdir -p /home/node/app/data
12
+
13
+ # 3. Copy the configuration template and the entrypoint script.
14
+ COPY config.template.yaml /home/node/app/config.template.yaml
15
+ COPY entrypoint.sh /home/node/app/entrypoint.sh
16
+
17
+ # --- Install the cloud-saves plugin EXACTLY as per the tutorial ---
18
+ # a. Define the target plugins directory specified by the tutorial.
19
+ ARG PLUGINS_DIR=/home/node/app/plugins
20
+
21
+ # b. Create the plugins directory.
22
+ RUN mkdir -p ${PLUGINS_DIR}
23
+
24
+ # c. Switch the working directory to the plugins folder.
25
+ WORKDIR ${PLUGINS_DIR}
26
+
27
+ # d. Run 'git clone' from within the plugins directory.
28
+ # This will create the 'cloud-saves' sub-directory automatically.
29
+ RUN git clone https://github.com/fuwei99/cloud-saves
30
+
31
+ # e. Switch the working directory into the newly created plugin folder.
32
+ WORKDIR ${PLUGINS_DIR}/cloud-saves
33
+
34
+ # f. Run 'npm install' to install dependencies.
35
+ RUN npm install
36
+
37
+ # g. Reset the working directory back to the application root.
38
+ WORKDIR /home/node/app
39
+ # --- End of plugin installation ---
40
+
41
+ # 4. Set ownership for the ENTIRE application directory to the 'node' user.
42
+ RUN chown -R node:node /home/node/app
43
+
44
+ # 5. Make the entrypoint script executable.
45
+ RUN chmod +x /home/node/app/entrypoint.sh
46
+
47
+ # 6. Switch to the final, non-privileged user.
48
+ USER node
49
+
50
+ # 7. Set the entrypoint to our script.
51
+ ENTRYPOINT ["/home/node/app/entrypoint.sh"]
config.template.yaml ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ dataRoot: ./data
2
+ listen: true
3
+ listenAddress:
4
+ ipv4: 0.0.0.0
5
+ ipv6: '[::]'
6
+ protocol:
7
+ ipv4: true
8
+ ipv6: false
9
+ dnsPreferIPv6: false
10
+ autorunHostname: "auto"
11
+ port: 8000
12
+ autorunPortOverride: -1
13
+ ssl:
14
+ enabled: false
15
+ certPath: "./certs/cert.pem"
16
+ keyPath: "./certs/privkey.pem"
17
+ whitelistMode: true # 模板里保持true或false不重要,脚本会强制修改
18
+ enableForwardedWhitelist: false
19
+ whitelist:
20
+ - ::1
21
+ - 127.0.0.1
22
+ whitelistDockerHosts: true
23
+ basicAuthMode: true
24
+ basicAuthUser:
25
+ username: "${BASIC_AUTH_USER}" # 从 Secret 读取用户名
26
+ password: "${BASIC_AUTH_PASS}" # 从 Secret 读取密码
27
+ enableCorsProxy: false
28
+ requestProxy:
29
+ enabled: false
30
+ url: "socks5://username:password@example.com:1080"
31
+ bypass:
32
+ - localhost
33
+ - 127.0.0.1
34
+ enableUserAccounts: false
35
+ enableDiscreetLogin: false
36
+ autheliaAuth: false
37
+ perUserBasicAuth: false
38
+ sessionTimeout: -1
39
+ disableCsrfProtection: false
40
+ securityOverride: false
41
+ logging:
42
+ enableAccessLog: true
43
+ minLogLevel: 0
44
+ rateLimiting:
45
+ preferRealIpHeader: false
46
+ autorun: false
47
+ avoidLocalhost: false
48
+ backups:
49
+ common:
50
+ numberOfBackups: 50
51
+ chat:
52
+ enabled: true
53
+ checkIntegrity: true
54
+ maxTotalBackups: -1
55
+ throttleInterval: 10000
56
+ thumbnails:
57
+ enabled: true
58
+ format: "jpg"
59
+ quality: 95
60
+ dimensions: { 'bg': [160, 90], 'avatar': [96, 144] }
61
+ performance:
62
+ lazyLoadCharacters: false
63
+ memoryCacheCapacity: '100mb'
64
+ useDiskCache: true
65
+ allowKeysExposure: true
66
+ skipContentCheck: false
67
+ whitelistImportDomains:
68
+ - localhost
69
+ - cdn.discordapp.com
70
+ - files.catbox.moe
71
+ - raw.githubusercontent.com
72
+ requestOverrides: []
73
+ extensions:
74
+ enabled: true
75
+ autoUpdate: false
76
+ models:
77
+ autoDownload: true
78
+ classification: Cohee/distilbert-base-uncased-go-emotions-onnx
79
+ captioning: Xenova/vit-gpt2-image-captioning
80
+ embedding: Cohee/jina-embeddings-v2-base-en
81
+ speechToText: Xenova/whisper-small
82
+ textToSpeech: Xenova/speecht5_tts
83
+ enableDownloadableTokenizers: true
84
+ promptPlaceholder: "[Start a new chat]"
85
+ openai:
86
+ randomizeUserId: false
87
+ captionSystemPrompt: ""
88
+ deepl:
89
+ formality: default
90
+ mistral:
91
+ enablePrefix: false
92
+ ollama:
93
+ keepAlive: -1
94
+ batchSize: -1
95
+ claude:
96
+ enableSystemPromptCache: false
97
+ cachingAtDepth: -1
98
+ enableServerPlugins: true
99
+ enableServerPluginsAutoUpdate: false
entrypoint.sh ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ # This script runs inside the container when it starts.
3
+ set -e
4
+
5
+ # 1. Generate the initial config.yaml from the template and environment variables (Secrets).
6
+ envsubst < /home/node/app/config.template.yaml > /home/node/app/config.yaml
7
+
8
+ # 2. Forcibly set all necessary plugin-related configurations.
9
+ sed -i 's/^ *whitelistMode:.*$/whitelistMode: false/' /home/node/app/config.yaml
10
+ sed -i 's/^ *enableServerPlugins:.*$/enableServerPlugins: true/' /home/node/app/config.yaml
11
+ sed -i 's/^ *enableServerPluginsAutoUpdate:.*$/enableServerPluginsAutoUpdate: false/' /home/node/app/config.yaml
12
+ sed -i 's/^ *extensions\.enabled:.*$/extensions.enabled: true/' /home/node/app/config.yaml
13
+
14
+ # 3. Start the main application.
15
+ exec node server.js