mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add Dockerfile for easy hosting TavernAI-GUI on multiple platforms.
Implements #18
This commit is contained in:
4
.dockerignore
Normal file
4
.dockerignore
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
node_modules
|
||||||
|
npm-debug.log
|
||||||
|
readme*
|
||||||
|
Start.bat
|
35
Dockerfile
Normal file
35
Dockerfile
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
FROM node:19.1.0-alpine3.16
|
||||||
|
|
||||||
|
# Arguments
|
||||||
|
ARG APP_HOME=/home/node/app
|
||||||
|
|
||||||
|
# Create app directory
|
||||||
|
WORKDIR ${APP_HOME}
|
||||||
|
|
||||||
|
|
||||||
|
# Install app dependencies
|
||||||
|
COPY package*.json ./
|
||||||
|
RUN \
|
||||||
|
echo "*** Install npm packages ***" && \
|
||||||
|
npm install
|
||||||
|
|
||||||
|
# Bundle app source
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Copy default chats, characters and user avatars to <folder>.default folder
|
||||||
|
RUN \
|
||||||
|
echo "*** Copy default chats, characters and user avatars to <folder>.default folder ***" && \
|
||||||
|
mv "./public/chats" "./public/chats.default" && \
|
||||||
|
mv "./public/characters" "./public/characters.default" && \
|
||||||
|
mv "./public/User Avatars" "./public/User Avatars.default"
|
||||||
|
|
||||||
|
# Cleanup unnecessary files
|
||||||
|
RUN \
|
||||||
|
echo "*** Cleanup ***" && \
|
||||||
|
mv "./docker/docker-entrypoint.sh" "./" && \
|
||||||
|
rm -rf "./docker" && \
|
||||||
|
rm -rf "./.git"
|
||||||
|
|
||||||
|
EXPOSE 8000
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/bin/sh", "-c", "./docker-entrypoint.sh" ]
|
14
docker/docker-compose.yml
Normal file
14
docker/docker-compose.yml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
tavernai:
|
||||||
|
build: ..
|
||||||
|
container_name: tavernai
|
||||||
|
hostname: tavernai
|
||||||
|
image: tavernai/tavernai:latest
|
||||||
|
ports:
|
||||||
|
- "8000:8000"
|
||||||
|
volumes:
|
||||||
|
- "./config/characters:/home/node/app/public/characters"
|
||||||
|
- "./config/chats:/home/node/app/public/chats"
|
||||||
|
- "./config/User Avatars:/home/node/app/public/User Avatars"
|
||||||
|
restart: unless-stopped
|
22
docker/docker-entrypoint.sh
Normal file
22
docker/docker-entrypoint.sh
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Check if the "characters" directory is empty
|
||||||
|
if [ -z "$(ls -A /home/node/app/public/characters)" ]; then
|
||||||
|
echo "Characters directory is empty. Copying default characters."
|
||||||
|
mv /home/node/app/public/characters.default/ /home/node/app/public/characters/
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if the "chats" directory is empty
|
||||||
|
if [ -z "$(ls -A /home/node/app/public/chats)" ]; then
|
||||||
|
echo "Chats directory is empty. Copying default chats."
|
||||||
|
mv /home/node/app/public/chats.default/ /home/node/app/public/chats/
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if the "User Avatars" directory is empty
|
||||||
|
if [ -z "$(ls -A '/home/node/app/public/User Avatars')" ]; then
|
||||||
|
echo "User Avatars directory is empty. Copying default user avatars."
|
||||||
|
mv /home/node/app/public/User\ Avatars.default/ '/home/node/app/public/User Avatars/'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Start the server
|
||||||
|
node /home/node/app/server.js
|
Reference in New Issue
Block a user