Spaces:
Build error
Build error
| # Use official Node.js 22 Slim as the base image | |
| FROM node:22-slim | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| python3 \ | |
| python3-pip \ | |
| python3-venv \ | |
| git \ | |
| curl \ | |
| ca-certificates \ | |
| && apt-get clean \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set up user with UID 1000 (standard for Hugging Face) | |
| RUN useradd -m -u 1000 user | |
| WORKDIR /home/user/app | |
| # Set up npm global folder in user's home directory to avoid permission issues | |
| ENV NPM_CONFIG_PREFIX=/home/user/.npm-global | |
| ENV PATH=$PATH:/home/user/.npm-global/bin | |
| # Set environment variables for Python | |
| ENV PYTHONUNBUFFERED=1 | |
| # Install python dependencies system-wide (using --break-system-packages to bypass PEP 668) | |
| RUN pip3 install gradio huggingface_hub --break-system-packages | |
| # Copy the app source code | |
| COPY --chown=user:user app.py /home/user/app/app.py | |
| # Switch to the non-root user | |
| USER user | |
| # Install qwen-code globally under the user's npm directory | |
| RUN npm install -g @qwen-code/qwen-code@latest | |
| # Initialize workspace folder and pre-configure git to avoid interactive prompts | |
| RUN mkdir -p /home/user/app/workspace \ | |
| && git config --global user.name "Qwen Code Demo" \ | |
| && git config --global user.email "demo@qwen.ai" | |
| # Expose port 7860 (Hugging Face default) | |
| EXPOSE 7860 | |
| # Run the app | |
| CMD ["python3", "app.py"] | |