2023-07-20 19:32:15 +02:00
|
|
|
FROM node:19.1.0-alpine3.16
|
|
|
|
|
|
|
|
# Arguments
|
|
|
|
ARG APP_HOME=/home/node/app
|
|
|
|
|
|
|
|
# Install system dependencies
|
2023-07-24 06:46:07 +02:00
|
|
|
RUN apk add gcompat tini git
|
2023-07-20 19:32:15 +02:00
|
|
|
|
|
|
|
# Ensure proper handling of kernel signals
|
|
|
|
ENTRYPOINT [ "tini", "--" ]
|
|
|
|
|
|
|
|
# Create app directory
|
|
|
|
WORKDIR ${APP_HOME}
|
|
|
|
|
2024-03-06 21:09:31 +01:00
|
|
|
# Set NODE_ENV to production
|
|
|
|
ENV NODE_ENV=production
|
|
|
|
|
2023-07-20 19:32:15 +02:00
|
|
|
# Install app dependencies
|
2023-09-15 20:44:48 +02:00
|
|
|
COPY package*.json post-install.js ./
|
2023-07-20 19:32:15 +02:00
|
|
|
RUN \
|
|
|
|
echo "*** Install npm packages ***" && \
|
2024-03-06 21:09:31 +01:00
|
|
|
npm i --no-audit --no-fund --quiet --omit=dev && npm cache clean --force
|
2023-07-20 19:32:15 +02:00
|
|
|
|
|
|
|
# Bundle app source
|
|
|
|
COPY . ./
|
|
|
|
|
|
|
|
# Copy default chats, characters and user avatars to <folder>.default folder
|
|
|
|
RUN \
|
2023-11-14 00:30:47 +01:00
|
|
|
IFS="," RESOURCES="assets,backgrounds,user,context,instruct,QuickReplies,movingUI,themes,characters,chats,groups,group chats,User Avatars,worlds,OpenAI Settings,NovelAI Settings,KoboldAI Settings,TextGen Settings" && \
|
2023-07-20 19:32:15 +02:00
|
|
|
\
|
|
|
|
echo "*** Store default $RESOURCES in <folder>.default ***" && \
|
2023-11-14 00:30:47 +01:00
|
|
|
for R in $RESOURCES; do mv "public/$R" "public/$R.default"; done || true && \
|
2023-07-20 19:32:15 +02:00
|
|
|
\
|
|
|
|
echo "*** Create symbolic links to config directory ***" && \
|
2023-11-14 00:30:47 +01:00
|
|
|
for R in $RESOURCES; do ln -s "../config/$R" "public/$R"; done || true && \
|
|
|
|
\
|
2023-12-15 11:43:27 +01:00
|
|
|
rm -f "config.yaml" "public/settings.json" || true && \
|
2023-11-25 22:45:33 +01:00
|
|
|
ln -s "./config/config.yaml" "config.yaml" || true && \
|
2023-11-14 00:30:47 +01:00
|
|
|
ln -s "../config/settings.json" "public/settings.json" || true && \
|
2024-02-11 14:36:20 +01:00
|
|
|
mkdir "config" || true && \
|
|
|
|
mkdir -p "public/user" || true
|
2023-07-20 19:32:15 +02:00
|
|
|
|
|
|
|
# Cleanup unnecessary files
|
|
|
|
RUN \
|
|
|
|
echo "*** Cleanup ***" && \
|
|
|
|
mv "./docker/docker-entrypoint.sh" "./" && \
|
|
|
|
rm -rf "./docker" && \
|
|
|
|
echo "*** Make docker-entrypoint.sh executable ***" && \
|
|
|
|
chmod +x "./docker-entrypoint.sh" && \
|
|
|
|
echo "*** Convert line endings to Unix format ***" && \
|
|
|
|
dos2unix "./docker-entrypoint.sh"
|
|
|
|
|
|
|
|
EXPOSE 8000
|
|
|
|
|
|
|
|
CMD [ "./docker-entrypoint.sh" ]
|