Add Docker support

This commit is contained in:
powermaker450 2024-07-25 12:55:48 -04:00
parent 63e9986384
commit f4592fff96
3 changed files with 61 additions and 0 deletions

25
Dockerfile Normal file
View file

@ -0,0 +1,25 @@
FROM node:20.12.2-alpine
RUN apk update > /dev/null && apk add git > /dev/null
RUN git clone https://git.povario.com/powermaker450/Tailchat-Assistant app > /dev/null
WORKDIR /app
RUN npm i && npm run build
ENV HOST="http://localhost:11000"
ENV ID=""
ENV SECRET=""
ENV API_ENDPOINT="http://localhost:8080/v1"
ENV API_KEY="none"
ENV TEXT_MODEL="gpt-4"
ENV CREATE_IMAGE_MODEL="stablediffusion-cpp"
ENV ANALYZE_IMAGE_MODEL="gpt-4-vision-preview"
ENV TEMPERATURE=1
ENV ALLOWED_CHAT=""
ENV SAFE_WORD="\\"
COPY ./entrypoint.sh ./entrypoint.sh
RUN chmod +x ./entrypoint.sh
ENTRYPOINT ["sh", "-c", "./entrypoint.sh"]

20
docker-compose.yml Normal file
View file

@ -0,0 +1,20 @@
services:
assistant:
container_name: tailchat_assistant
image: tailchat_assistant
build:
context: .
env_file: ".env"
environment:
- HOST=${HOST}
- ID=${ID}
- SECRET=${SECRET}
- API_ENDPOINT=${API_ENDPOINT}
- API_KEY=${API_KEY}
- TEXT_MODEL=${TEXT_MODEL}
- CREATE_IMAGE_MODEL=${CREATE_IMAGE_MODEL}
- ANALYZE_IMAGE_MODEL=${ANALYZE_IMAGE_MODEL}
- ALLOWED_CHAT=${ALLOWED_CHAT}
- SAFE_WORD=${SAFE_WORD}
volumes:
- ./persist:/app/persist

16
entrypoint.sh Normal file
View file

@ -0,0 +1,16 @@
cd /app
echo "" > .env && \
echo "HOST=$HOST" >> .env && \
echo "ID=$ID" >> .env && \
echo "SECRET=$SECRET" >> .env && \
echo "API_ENDPOINT=$API_ENDPOINT" >> .env && \
echo "API_KEY=$API_KEY" >> .env && \
echo "TEXT_MODEL=$TEXT_MODEL" >> .env && \
echo "CREATE_IMAGE_MODEL=$CREATE_IMAGE_MODEL" >> .env && \
echo "ANALYZE_IMAGE_MODEL=$ANALYZE_IMAGE_MODEL" >> .env && \
echo "TEMPERATURE=$TEMPERATURE" >> .env && \
echo "ALLOWED_CHAT=$ALLOWED_CHAT" >> .env && \
echo "SAFE_WORD=$SAFE_WORD" >> .env
npm run start