File size: 1,242 Bytes
2909c70
 
 
 
 
 
 
 
 
 
f1bad0b
64a69fe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f1bad0b
2909c70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Base image for Python
FROM python:3.10-slim

# Install dependencies for Ollama
RUN apt-get update && apt-get install -y curl unzip && rm -rf /var/lib/apt/lists/*

# Install Ollama server
# Set working directory for the app
WORKDIR /app

# Create a directory for Ollama
RUN apt-get update && apt-get install -y \
    curl \
    build-essential \
    libffi-dev \
    cmake \
    libcurl4-openssl-dev \
    tini && \
    apt-get clean

# Upgrade pip and install dependencies
RUN python -m venv venv && \
    . /app/venv/bin/activate && \
    pip install --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt

# Install Ollama
RUN curl https://ollama.ai/install.sh | sh

# Create the directory and give appropriate permissions
RUN mkdir -p /.ollama && chmod 777 /.ollama

# Ensure Ollama binary is in the PATH
ENV PATH="/app/venv/bin:/root/.ollama/bin:$PATH"

# Copy application files and model
COPY . /app

# Install Python dependencies
RUN pip install --no-cache-dir gradio requests

# Expose ports for Gradio and Ollama
EXPOSE 7860 11434

# Start both services using a script
COPY start_services.sh /app/start_services.sh
RUN chmod +x /app/start_services.sh

# Run the start_services.sh script
CMD ["/app/start_services.sh"]