# Start with Ubuntu 24.04 (Noble) FROM ubuntu:oracular # Avoid prompts from apt ENV DEBIAN_FRONTEND=noninteractive # Install essential packages and tools RUN apt-get update && apt-get install -y curl wget git nginx # Free advertising :) LABEL maintainer="sam@defact.org" \ description="Free multimodal inference api running in node via docker and HF serverless inference" \ usage="https://huggingface.co/spaces/DeFactOfficial/MMAPI" # Set up a new user named "user" with user ID 1000 RUN useradd -o -u 1000 user # Switch to the "user" user USER user # Set home to the user's home directory ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ STATIC_SITE_user=$HOME/code/public # Install Node.js 20 (using n instead of nodesource for better HF compatibility) RUN curl -L https://raw.githubusercontent.com/tj/n/master/bin/n -o n \ && bash n 20 \ && rm n \ && npm install -g npm@latest # pm2 is awesome... lets you run node.js scripts as services with zero configuration #RUN npm install pm2 -g # Create working directory that matches HF Spaces expectations WORKDIR $HOME/code # Clone your repository (replace with your actual repo URL) # RUN git clone https://huggingface.co/spaces/DeFactOfficial/MMAPI-2 . #RUN git pull # Copy the current directory contents into the container at $HOME/app setting the owner to the user ADD . $HOME/code COPY --chown=user . $HOME/code # INSTALL NPM PACKAGES # INSTALL FFMPEG TOOLING # FIRE UP API # Loading Dependencies RUN npm install #RUN $HOME/code/ffmpeg_install.sh # Expose application's default port EXPOSE 7860 # Start all services in background with logging #cd /code/service1 && ./run.sh > /var/log/service1.log 2>&1 & #cd /code/service2 && ./run.sh > /var/log/service2.log 2>&1 & #cd /code/service3 && ./run.sh > /var/log/service3.log 2>&1 & # Start the API ENTRYPOINT ["node", "./api.js"]