Spaces:
Build error
Build error
| # Get a distribution that has uv already installed | |
| FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim | |
| # Add a non-root user and set up the home directory | |
| RUN useradd -m -u 1000 user | |
| ENV HOME=/home/user | |
| ENV UV_CACHE_DIR=$HOME/.cache/uv | |
| ENV UVICORN_WS_PROTOCOL=websockets | |
| # Create cache directories and set permissions | |
| RUN mkdir -p $UV_CACHE_DIR | |
| RUN chown -R user:user $HOME | |
| RUN chmod -R 777 $HOME/.cache/uv | |
| # Set working directory to the user's home directory | |
| WORKDIR $HOME | |
| # Install Node.js and npm (which includes npx) | |
| RUN apt-get update && apt-get install -y \ | |
| gcc \ | |
| make \ | |
| curl \ | |
| unzip \ | |
| gnupg \ | |
| python3-dev | |
| RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - | |
| RUN apt-get install -y nodejs | |
| RUN apt-get clean | |
| # RUN rm -rf /var/lib/apt/lists/* | |
| # Install ta-lib | |
| RUN curl -L https://github.com/ta-lib/ta-lib/releases/download/v0.6.4/ta-lib-0.6.4-src.tar.gz -o ta-lib.tar.gz | |
| RUN tar -xzf ta-lib.tar.gz && rm ta-lib.tar.gz | |
| WORKDIR $HOME/ta-lib-0.6.4 | |
| RUN ./configure --prefix=/usr --disable-dependency-tracking | |
| RUN make | |
| RUN make install | |
| # Set working directory | |
| WORKDIR $HOME/mcp | |
| # Download the repository zip file | |
| RUN curl -L https://github.com/wshobson/mcp-trader/archive/refs/heads/main.zip -o mcp-trader.zip | |
| # Unzip the repository and remove the zip file | |
| RUN unzip mcp-trader.zip && rm mcp-trader.zip | |
| # Run uv sync and uv build in the correct directory | |
| RUN cd mcp-trader-main && uv sync && uv build | |
| # Change permissions for the cache directory | |
| RUN chmod -R 777 $HOME/.cache/uv | |
| RUN chmod -R 777 $HOME/mcp | |
| # Switch to the non-root user | |
| USER user | |
| # Set the working directory | |
| WORKDIR $HOME/app | |
| # Copy the app to the container | |
| COPY . . | |
| # Install the dependencies | |
| RUN uv sync | |
| # Expose the port Chainlit runs on (usually 8000) | |
| EXPOSE 7860 | |
| # Command to run the app | |
| CMD ["uv", "run", "chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"] | |