Spaces:
Running
Running
Create Dockerfile
Browse files- Dockerfile +72 -0
Dockerfile
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM ubuntu:22.04
|
2 |
+
|
3 |
+
# Set environment variables
|
4 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
5 |
+
ENV HOME=/root
|
6 |
+
|
7 |
+
# Install dependencies, add deadsnakes PPA for Python 3.12
|
8 |
+
RUN apt-get update && \
|
9 |
+
apt-get install -y software-properties-common && \
|
10 |
+
add-apt-repository ppa:deadsnakes/ppa && \
|
11 |
+
apt-get update && \
|
12 |
+
apt-get install -y \
|
13 |
+
curl \
|
14 |
+
wget \
|
15 |
+
gpg \
|
16 |
+
apt-transport-https \
|
17 |
+
git \
|
18 |
+
nodejs \
|
19 |
+
npm \
|
20 |
+
python3.12 \
|
21 |
+
python3.12-venv \
|
22 |
+
python3.12-dev \
|
23 |
+
python3.12-distutils \
|
24 |
+
python3-pip && \
|
25 |
+
# Make Python 3.12 the default
|
26 |
+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1 && \
|
27 |
+
update-alternatives --set python3 /usr/bin/python3.12 && \
|
28 |
+
# Install pip for Python 3.12
|
29 |
+
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12 && \
|
30 |
+
# Install code-server
|
31 |
+
curl -fsSL https://code-server.dev/install.sh | sh && \
|
32 |
+
apt-get clean && \
|
33 |
+
rm -rf /var/lib/apt/lists/*
|
34 |
+
|
35 |
+
# Create a directory for the workspace
|
36 |
+
RUN mkdir -p /workspace
|
37 |
+
|
38 |
+
# Create configuration directory for code-server and Ollama
|
39 |
+
RUN mkdir -p /root/.config/code-server /root/.ollama
|
40 |
+
|
41 |
+
# Configure code-server to run on port 8443
|
42 |
+
RUN echo "bind-addr: 0.0.0.0:8443\nauth: none\ncert: false" > /root/.config/code-server/config.yaml
|
43 |
+
|
44 |
+
# Install Ollama after code-server is set up
|
45 |
+
RUN curl -fsSL https://ollama.com/install.sh | sh || true
|
46 |
+
|
47 |
+
# Install some useful VS Code extensions
|
48 |
+
RUN code-server --install-extension ms-python.python && \
|
49 |
+
code-server --install-extension ritwickdey.LiveServer && \
|
50 |
+
code-server --install-extension ms-toolsai.jupyter
|
51 |
+
|
52 |
+
# Create a startup script
|
53 |
+
RUN echo '#!/bin/bash\n\
|
54 |
+
# Start Ollama in the background\n\
|
55 |
+
/usr/local/bin/ollama serve &\n\
|
56 |
+
\n\
|
57 |
+
# Give Ollama a moment to start\n\
|
58 |
+
sleep 2\n\
|
59 |
+
\n\
|
60 |
+
# Start code-server in the foreground\n\
|
61 |
+
exec code-server --disable-telemetry --bind-addr 0.0.0.0:8443 /workspace\n\
|
62 |
+
' > /start.sh && \
|
63 |
+
chmod +x /start.sh
|
64 |
+
|
65 |
+
# Expose ports for both services
|
66 |
+
EXPOSE 8443 11434
|
67 |
+
|
68 |
+
# Set the workspace as working directory
|
69 |
+
WORKDIR /workspace
|
70 |
+
|
71 |
+
# Start both services
|
72 |
+
CMD ["/start.sh"]
|