# ───────────────────────────────────────────────────────────── # HuggingFace Docker Space — HF Terminal # Base: node:20-slim → Node + npm built-in, Python added # ───────────────────────────────────────────────────────────── FROM node:20-slim # Install Python 3 + system tools RUN apt-get update && apt-get install -y \ python3 python3-pip python3-venv \ curl wget git vim nano tree htop \ net-tools iputils-ping dnsutils \ zip unzip tar gzip \ gcc g++ make \ jq bc ca-certificates \ --no-install-recommends \ && ln -sf /usr/bin/python3 /usr/local/bin/python3 \ && ln -sf /usr/bin/python3 /usr/local/bin/python \ && rm -rf /var/lib/apt/lists/* # Update npm to latest and install useful global packages RUN npm install -g npm@latest \ && npm install -g yarn pnpm typescript ts-node nodemon WORKDIR /app # Python deps (pip with --break-system-packages for Debian bookworm) COPY requirements.txt . RUN pip3 install --no-cache-dir --break-system-packages -r requirements.txt COPY . . # HuggingFace runs as uid 1000 RUN useradd -m -u 1000 user \ && chown -R user:user /app USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:/home/user/.npm-global/bin:/usr/local/bin:/usr/bin:$PATH \ NPM_CONFIG_PREFIX=/home/user/.npm-global \ NODE_PATH=/usr/local/lib/node_modules \ PYTHONUNBUFFERED=1 EXPOSE 7860 CMD ["python3", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "2"]