File size: 1,896 Bytes
e0ba3a7
 
 
79a4fbe
e0ba3a7
79a4fbe
 
 
e0ba3a7
79a4fbe
 
 
 
e0ba3a7
79a4fbe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f09497a
e0ba3a7
 
 
 
79a4fbe
e0ba3a7
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# 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"]