miike-ai commited on
Commit
f530cbe
·
verified ·
1 Parent(s): f8caa7b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -7
Dockerfile CHANGED
@@ -9,10 +9,11 @@ ENV USER=coder
9
  RUN useradd -m -d $HOME -s /bin/bash $USER && \
10
  echo "$USER ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
11
 
12
- # Install dependencies and code-server
13
  RUN apt-get update && \
14
- apt-get install -y curl wget gpg apt-transport-https git nodejs npm python3 python3-pip && \
15
  curl -fsSL https://code-server.dev/install.sh | sh && \
 
16
  apt-get clean && \
17
  rm -rf /var/lib/apt/lists/*
18
 
@@ -34,8 +35,22 @@ RUN code-server --install-extension ms-python.python && \
34
  # Create a workspace directory
35
  RUN mkdir -p $HOME/workspace
36
 
37
- # Expose the port
38
- EXPOSE 7860
39
-
40
- # Set command to start code-server
41
- CMD ["code-server", "--disable-telemetry", "--bind-addr", "0.0.0.0:7860", "/home/coder/workspace"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  RUN useradd -m -d $HOME -s /bin/bash $USER && \
10
  echo "$USER ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
11
 
12
+ # Install dependencies, code-server, and ollama
13
  RUN apt-get update && \
14
+ apt-get install -y curl wget gpg apt-transport-https sudo git nodejs npm python3 python3-pip && \
15
  curl -fsSL https://code-server.dev/install.sh | sh && \
16
+ curl -fsSL https://ollama.com/install.sh | sh && \
17
  apt-get clean && \
18
  rm -rf /var/lib/apt/lists/*
19
 
 
35
  # Create a workspace directory
36
  RUN mkdir -p $HOME/workspace
37
 
38
+ # Create a startup script to run both services
39
+ USER root
40
+ RUN echo '#!/bin/bash\n\
41
+ # Start ollama in the background\n\
42
+ ollama serve &\n\
43
+ \n\
44
+ # Give ollama a moment to start\n\
45
+ sleep 2\n\
46
+ \n\
47
+ # Start code-server in the foreground\n\
48
+ exec sudo -u $USER code-server --disable-telemetry --bind-addr 0.0.0.0:7860 /home/coder/workspace\n\
49
+ ' > /start.sh && \
50
+ chmod +x /start.sh
51
+
52
+ # Expose ports for both services
53
+ EXPOSE 7860 11434
54
+
55
+ # Start both services
56
+ CMD ["/start.sh"]