# Start from a Node.js base image FROM node:20-slim # Install system dependencies for Python, venv, and curl RUN apt-get update && apt-get install -y python3-pip python3-venv curl && apt-get clean # The 'node:20-slim' image already includes a non-root user named 'node'. USER node # Set the home directory ENV HOME=/home/node # Configure npm to use a user-owned directory for global packages ENV NPM_CONFIG_PREFIX=${HOME}/.npm-global # Create and activate a Python virtual environment by adding it to the PATH ENV VENV_PATH=${HOME}/app/venv ENV PATH=${VENV_PATH}/bin:${NPM_CONFIG_PREFIX}/bin:${HOME}/.local/bin:${PATH} # Set the working directory WORKDIR ${HOME}/app # Install 'uv', the fast Python package manager RUN curl -LsSf https://astral.sh/uv/install.sh | sh # Install 'bun' globally into the user's home directory RUN npm install -g bun # Create the virtual environment RUN uv venv # Copy the Python requirements file COPY --chown=node requirements.txt . # Install packages into the virtual environment RUN uv pip install -r requirements.txt # Copy all other application files COPY --chown=node . . # Expose the port (the port number here is for documentation; the one in the CMD matters) EXPOSE 7860 # --- FIX: Add '--host 0.0.0.0' to the startup command --- # This tells the server to listen on all network interfaces, not just localhost. # We also use ${PORT-7860} to dynamically get the port from Hugging Face. CMD npx -y @srbhptl39/mcp-superassistant-proxy@latest --config config.json --host 0.0.0.0 --port ${PORT-7860} --baseUrl $SPACE_HOST