File size: 2,736 Bytes
3b5376c
 
 
 
 
d8e43fa
 
 
 
3b5376c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1b0bc86
 
 
3b5376c
 
 
 
 
 
 
 
 
 
1b0bc86
 
 
3b5376c
 
 
1b0bc86
 
 
 
 
 
 
 
3b5376c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
FROM ubuntu:22.04

# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV HOME=/root
# CUDA paths for when running on GPU (RunPod)
ENV CUDA_HOME=/usr/local/cuda
ENV PATH=${CUDA_HOME}/bin:${PATH}
ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}

# Install dependencies, add deadsnakes PPA for Python 3.12
RUN apt-get update && \
    apt-get install -y software-properties-common && \
    add-apt-repository ppa:deadsnakes/ppa && \
    apt-get update && \
    apt-get install -y \
        curl \
        wget \
        gpg \
        apt-transport-https \
        git \
        python3.12 \
        python3.12-venv \
        python3.12-dev \
        python3-pip && \
    # Install Node.js 22.x from NodeSource
    curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
    apt-get install -y nodejs && \
    # Make Python 3.12 the default
    update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1 && \
    update-alternatives --set python3 /usr/bin/python3.12 && \
    # Install pip for Python 3.12
    curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12 && \
    # Install code-server
    curl -fsSL https://code-server.dev/install.sh | sh && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Install global npm packages
RUN npm install -g @anthropic-ai/claude-code @anthropic-ai/dxt

# Create a directory for the workspace
RUN mkdir -p /workspace

# Copy requirements file (if it exists)
COPY requirements.txt* /workspace/

# Install Python packages if requirements.txt exists
RUN if [ -f /workspace/requirements.txt ]; then \
        pip3 install --no-cache-dir -r /workspace/requirements.txt; \
    fi

# Create configuration directory for code-server and Ollama
RUN mkdir -p /root/.config/code-server /root/.ollama

# Configure code-server to run on port 8443
RUN echo "bind-addr: 0.0.0.0:8443\nauth: none\ncert: false" > /root/.config/code-server/config.yaml

# Install Ollama after code-server is set up
RUN curl -fsSL https://ollama.com/install.sh | sh || true

# Install some useful VS Code extensions
RUN code-server --install-extension ms-python.python && \
    code-server --install-extension ritwickdey.LiveServer && \
    code-server --install-extension ms-toolsai.jupyter

# Create a startup script
RUN echo '#!/bin/bash\n\
# Start Ollama in the background\n\
/usr/local/bin/ollama serve &\n\
\n\
# Give Ollama a moment to start\n\
sleep 2\n\
\n\
# Start code-server in the foreground\n\
exec code-server --disable-telemetry --bind-addr 0.0.0.0:8443 /workspace\n\
' > /start.sh && \
chmod +x /start.sh

# Expose ports for both services
EXPOSE 8443 11434

# Set the workspace as working directory
WORKDIR /workspace

# Start both services
CMD ["/start.sh"]