vscode / Dockerfile
miike-ai's picture
Update Dockerfile
d3d1a02 verified
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"]