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}
|
|
|
|
|
|
|
|
# Install app dependencies
|
|
|
|
COPY package*.json ./
|
|
|
|
RUN \
|
|
|
|
echo "*** Install npm packages ***" && \
|
|
|
|
npm install && npm cache clean --force
|
|
|
|
|
|
|
|
# Bundle app source
|
|
|
|
COPY . ./
|
|
|
|
|
|
|
|
# Copy default chats, characters and user avatars to <folder>.default folder
|
|
|
|
RUN \
|
2023-07-23 15:52:25 +02:00
|
|
|
IFS="," RESOURCES="characters,chats,groups,group chats,User Avatars,worlds" && \
|
2023-07-20 19:32:15 +02:00
|
|
|
\
|
|
|
|
echo "*** Store default $RESOURCES in <folder>.default ***" && \
|
|
|
|
for R in $RESOURCES; do mv "public/$R" "public/$R.default"; done && \
|
|
|
|
\
|
|
|
|
echo "*** Create symbolic links to config directory ***" && \
|
|
|
|
for R in $RESOURCES; do ln -s "../config/$R" "public/$R"; done && \
|
2023-07-23 15:52:25 +02:00
|
|
|
# rm "config.conf" "public/settings.json" "public/css/bg_load.css" && \
|
|
|
|
ln -s "./config/config.conf" "config.conf" && \
|
|
|
|
ln -s "../config/settings.json" "public/settings.json" && \
|
|
|
|
ln -s "../../config/bg_load.css" "public/css/bg_load.css" && \
|
2023-07-20 19:32:15 +02:00
|
|
|
mkdir "config"
|
|
|
|
|
|
|
|
# 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" ]
|