46 lines
1.1 KiB
Docker
46 lines
1.1 KiB
Docker
FROM node:lts-alpine3.18
|
|
|
|
# Arguments
|
|
ARG APP_HOME=/home/node/app
|
|
|
|
# Install system dependencies
|
|
RUN apk add gcompat tini git
|
|
|
|
# Ensure proper handling of kernel signals
|
|
ENTRYPOINT [ "tini", "--" ]
|
|
|
|
# Create app directory
|
|
WORKDIR ${APP_HOME}
|
|
|
|
# Set NODE_ENV to production
|
|
ENV NODE_ENV=production
|
|
|
|
# Install app dependencies
|
|
COPY package*.json post-install.js ./
|
|
RUN \
|
|
echo "*** Install npm packages ***" && \
|
|
npm i --no-audit --no-fund --quiet --omit=dev && npm cache clean --force
|
|
|
|
# Bundle app source
|
|
COPY . ./
|
|
|
|
# Copy default chats, characters and user avatars to <folder>.default folder
|
|
RUN \
|
|
rm -f "config.yaml" || true && \
|
|
ln -s "./config/config.yaml" "config.yaml" || true && \
|
|
mkdir "config" || true
|
|
|
|
# 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" ]
|