cula0707 commited on
Commit
a4ecc59
·
verified ·
1 Parent(s): 546eff1

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +33 -0
Dockerfile ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Github@bainiao0706 https://github.com/bainiao0706/SillyTavern-OHFS Stars appreciated.
2
+ FROM node:18-alpine
3
+
4
+ # Install essential system utilities
5
+ RUN apk add --no-cache git shadow
6
+
7
+ # Set temporary workspace for building dependencies locally
8
+ WORKDIR /app
9
+
10
+ # Clone production source and install node modules into local container storage (/app)
11
+ RUN git clone https://github.com/SillyTavern/SillyTavern.git /app && \
12
+ npm install --only=production
13
+
14
+ # Set standard application runtime environments
15
+ ENV BACKGROUND_COLOR=black
16
+ ENV NODE_ENV=production
17
+
18
+ # Expose internal service port
19
+ EXPOSE 7860
20
+
21
+ # Runtime pipeline: Clean Storage Init -> Symlink Junction -> Launch
22
+ CMD echo "[INFO] Starting SillyTavern..." && \
23
+ if [ ! -f /data/server.js ]; then \
24
+ echo "[INFO] /data is empty. Performing clean clone into persistent storage..." && \
25
+ git clone https://github.com/SillyTavern/SillyTavern.git /data; \
26
+ fi && \
27
+ echo "[INFO] Resolving NFS directory locks and establishing symlinks..." && \
28
+ if [ -d /data/node_modules ] && [ ! -L /data/node_modules ]; then \
29
+ mv /data/node_modules /data/.legacy_node_modules_$(date +%s) 2>/dev/null || rm -rf /data/node_modules; \
30
+ fi && \
31
+ ln -sf /app/node_modules /data/node_modules && \
32
+ echo "[INFO] Redirecting workspace environment and launching server..." && \
33
+ cd /data && DATA_DIR=/data node server.js