ash-171 commited on
Commit
56babd9
·
verified ·
1 Parent(s): aa8e251

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -21
Dockerfile CHANGED
@@ -1,50 +1,40 @@
1
  # Base image with GPU support
2
  FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
3
 
4
- # Set env vars
5
  ENV DEBIAN_FRONTEND=noninteractive
6
  ENV PYTHONDONTWRITEBYTECODE=1
7
  ENV PYTHONUNBUFFERED=1
8
 
9
- # Install Python and other system dependencies
10
  RUN apt-get update && apt-get install -y \
11
  python3 python3-pip ffmpeg curl git wget sudo \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
- # Ensure `python` points to `python3`
15
  RUN ln -sf /usr/bin/python3 /usr/bin/python && pip install --upgrade pip
16
 
17
- # Add a user to avoid running everything as root (best practice)
18
- RUN useradd -ms /bin/bash ollama
19
- USER ollama
20
- WORKDIR /home/ollama
21
-
22
- # Install Ollama as user
23
  RUN curl -L https://ollama.com/download/OllamaLinux -o /usr/local/bin/ollama && \
24
  chmod +x /usr/local/bin/ollama
25
 
26
-
27
- # Switch back to root to install Python packages globally
28
- USER root
29
-
30
- # Create working directory for your app
31
  WORKDIR /app
32
 
33
- # Copy project files
34
  COPY . .
35
 
36
- # Download SpeechBrain model interface if needed
37
  RUN wget -O src/custome_interface.py https://huggingface.co/Jzuluaga/accent-id-commonaccent_xlsr-en-english/resolve/main/custom_interface.py
38
 
39
  # Install Python dependencies
40
  RUN pip install -r requirements.txt
41
 
42
- # Expose Streamlit default port
43
  EXPOSE 8501
44
 
45
- # Entrypoint: Start Ollama server, wait a bit, pull model, then launch Streamlit
46
  CMD bash -c "\
47
- /home/ollama/.ollama/bin/ollama serve & \
48
- sleep 5 && \
49
- /home/ollama/.ollama/bin/ollama pull gemma3 && \
50
  streamlit run streamlit_app.py --server.port=8501 --server.address=0.0.0.0"
 
1
  # Base image with GPU support
2
  FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
3
 
 
4
  ENV DEBIAN_FRONTEND=noninteractive
5
  ENV PYTHONDONTWRITEBYTECODE=1
6
  ENV PYTHONUNBUFFERED=1
7
 
8
+ # Install Python and dependencies
9
  RUN apt-get update && apt-get install -y \
10
  python3 python3-pip ffmpeg curl git wget sudo \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
+ # Fix Python path and upgrade pip
14
  RUN ln -sf /usr/bin/python3 /usr/bin/python && pip install --upgrade pip
15
 
16
+ # Install Ollama (must be as root to write to /usr/local/bin)
 
 
 
 
 
17
  RUN curl -L https://ollama.com/download/OllamaLinux -o /usr/local/bin/ollama && \
18
  chmod +x /usr/local/bin/ollama
19
 
20
+ # Create app directory
 
 
 
 
21
  WORKDIR /app
22
 
23
+ # Copy code
24
  COPY . .
25
 
26
+ # Download model interface
27
  RUN wget -O src/custome_interface.py https://huggingface.co/Jzuluaga/accent-id-commonaccent_xlsr-en-english/resolve/main/custom_interface.py
28
 
29
  # Install Python dependencies
30
  RUN pip install -r requirements.txt
31
 
32
+ # Expose Streamlit port
33
  EXPOSE 8501
34
 
35
+ # Start everything
36
  CMD bash -c "\
37
+ ollama serve & \
38
+ sleep 10 && \
39
+ ollama pull gemma3 && \
40
  streamlit run streamlit_app.py --server.port=8501 --server.address=0.0.0.0"