FROM node:18 # Set up working directory WORKDIR /app # Install required dependencies for building llama.cpp and running FreedomGPT RUN apt-get update && apt-get install -y \ git \ make \ g++ \ cmake \ wget \ unzip \ libnss3 \ libatk1.0-0 \ libatk-bridge2.0-0 \ libx11-xcb1 \ libasound2 \ libxcomposite1 \ libxcursor1 \ libxdamage1 \ libxrandr2 \ libgbm1 \ libgtk-3-0 \ libxfont2 \ x11-xserver-utils \ xvfb \ dbus \ && rm -rf /var/lib/apt/lists/* # Clone the FreedomGPT repository RUN git clone --recursive https://github.com/ohmplatform/FreedomGPT.git freedom-gpt # Navigate to the project directory WORKDIR /app/freedom-gpt # Install Node.js dependencies RUN npx yarn install # Build the llama.cpp library for Linux WORKDIR /app/freedom-gpt/llama.cpp RUN make # Navigate back to the root directory WORKDIR /app/freedom-gpt # Install additional npm dependencies RUN npm install # Create the models directory if it doesn't exist RUN mkdir -p /app/freedom-gpt/models # Set ownership of the working directory to the node user RUN chown -R node:node /app # Switch to the node user USER node # Set environment variables or additional paths for Hugging Face models ENV HF_MODELS_PATH=/app/freedom-gpt/models # Expose the necessary port (default 3000; can be adjusted in src/ports.ts) EXPOSE 3000 # Command to start the app CMD ["xvfb-run", "--server-args=-screen 0 1024x768x24", "npx", "yarn", "start"]