File size: 1,545 Bytes
cc2adf5 e388c47 3f905b2 e388c47 cc2adf5 718fcd1 cc2adf5 718fcd1 3f905b2 e388c47 cc2adf5 d3d1a02 718fcd1 e388c47 718fcd1 cc2adf5 718fcd1 f530cbe e388c47 718fcd1 f530cbe e388c47 f530cbe d3d1a02 f530cbe d3d1a02 f530cbe 718fcd1 f530cbe e388c47 | 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 | FROM ubuntu:22.04
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV HOME=/root
# Install dependencies, code-server, and Ollama
RUN apt-get update && \
apt-get install -y curl wget gpg apt-transport-https git nodejs npm python3 python3-pip && \
curl -fsSL https://code-server.dev/install.sh | sh && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Create a directory for the workspace
RUN mkdir -p /workspace
# Create configuration directory for code-server and Ollama
RUN mkdir -p /root/.config/code-server /root/.ollama
# Configure code-server to run on port 7860 (Hugging Face Spaces default)
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"]
|