# Use the official Node.js image as the base image | |
FROM node:20.4 | |
# Set the working directory in the container | |
WORKDIR /app | |
# Clone repository with secret mount | |
RUN --mount=type=secret,id=CLONE,mode=0444,required=true \ | |
git clone https://github.com/tutoihoc/SillyTavern.git . | |
# Change ownership and permissions | |
RUN chown -R node:node /app && \ | |
chmod -R 755 /app | |
# Switch to non-root user | |
USER node | |
# Install dependencies | |
RUN npm install | |
# Create webpack directory with correct permissions | |
RUN mkdir -p /app/dist/webpack && \ | |
chmod -R 755 /app/dist | |
# Start the application | |
CMD ["node", "server.js"] |