abanm commited on
Commit
4cde9f3
·
verified ·
1 Parent(s): 55460df

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -46
Dockerfile CHANGED
@@ -6,28 +6,6 @@ FROM ubuntu:22.04
6
  # Avoid interactive prompts during build
7
  ENV DEBIAN_FRONTEND=noninteractive
8
 
9
- # ----------------------------------------------------------
10
- # 2. Install dependencies
11
- # ----------------------------------------------------------
12
- RUN apt-get update && apt-get install -y --no-install-recommends \
13
- wget \
14
- curl \
15
- ca-certificates \
16
- git \
17
- build-essential \
18
- python3 \
19
- python3-pip \
20
- && rm -rf /var/lib/apt/lists/*
21
-
22
- # ----------------------------------------------------------
23
- # ----------------------------------------------------------
24
- # 1. Base image
25
- # ----------------------------------------------------------
26
- FROM ubuntu:22.04
27
-
28
- # Avoid interactive prompts during build
29
- ENV DEBIAN_FRONTEND=noninteractive
30
-
31
  # ----------------------------------------------------------
32
  # 2. Install dependencies
33
  # ----------------------------------------------------------
@@ -46,49 +24,38 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
46
  # ----------------------------------------------------------
47
  RUN curl -fsSL https://ollama.com/install.sh | bash
48
 
 
 
 
 
 
49
 
50
  # ----------------------------------------------------------
51
- # 4. Copy Python requirements and install
52
  # ----------------------------------------------------------
53
  WORKDIR /app
54
- COPY requirements.txt /app/requirements.txt
55
  RUN pip3 install --no-cache-dir -r requirements.txt
56
 
57
  # ----------------------------------------------------------
58
- # 5. Copy application files
59
  # ----------------------------------------------------------
60
  COPY app.py /app/app.py
61
 
62
  # ----------------------------------------------------------
63
- # 6. Environment variables & expose port
64
  # ----------------------------------------------------------
65
- # By default, set an example API key (override at runtime/Secrets)
66
  ENV OLLAMA_API_KEY=change_me
67
-
68
- # We must expose 7860 for Hugging Face Spaces
69
  EXPOSE 7860
70
 
71
  # ----------------------------------------------------------
72
- # 7. Start Ollama in background and then run the FastAPI server
73
  # ----------------------------------------------------------
74
- # The model is pulled from HF: abanm/Dubs-Q8_0-GGUF
75
-
76
- # Set a working directory where Ollama can create necessary files
77
- WORKDIR /ollama-data
78
-
79
- # Ensure the directory exists and set appropriate permissions
80
- RUN mkdir -p /ollama-data && chmod 777 /ollama-data
81
-
82
- # Copy the entrypoint script into the container
83
- COPY entrypoint.sh /entrypoint.sh
84
- RUN chmod +x /entrypoint.sh
85
- #
86
- # "ollama serve" runs on default port 11411. We'll run that in the background,
87
- # then run uvicorn on 7860.
88
- # Copy the entrypoint script into the container
89
  COPY entrypoint.sh /entrypoint.sh
90
  RUN chmod +x /entrypoint.sh
91
 
92
- # Use the entrypoint script to start the services
 
 
93
  CMD ["/entrypoint.sh"]
94
 
 
6
  # Avoid interactive prompts during build
7
  ENV DEBIAN_FRONTEND=noninteractive
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  # ----------------------------------------------------------
10
  # 2. Install dependencies
11
  # ----------------------------------------------------------
 
24
  # ----------------------------------------------------------
25
  RUN curl -fsSL https://ollama.com/install.sh | bash
26
 
27
+ # ----------------------------------------------------------
28
+ # 4. Create directory for Ollama data + set OLLAMA_HOME
29
+ # ----------------------------------------------------------
30
+ ENV OLLAMA_HOME=/ollama-data
31
+ RUN mkdir -p /ollama-data && chmod 777 /ollama-data
32
 
33
  # ----------------------------------------------------------
34
+ # 5. Copy Python requirements and install
35
  # ----------------------------------------------------------
36
  WORKDIR /app
37
+ COPY requirements.txt .
38
  RUN pip3 install --no-cache-dir -r requirements.txt
39
 
40
  # ----------------------------------------------------------
41
+ # 6. Copy application files
42
  # ----------------------------------------------------------
43
  COPY app.py /app/app.py
44
 
45
  # ----------------------------------------------------------
46
+ # 7. Environment variables & expose port
47
  # ----------------------------------------------------------
 
48
  ENV OLLAMA_API_KEY=change_me
 
 
49
  EXPOSE 7860
50
 
51
  # ----------------------------------------------------------
52
+ # 8. Copy and set entrypoint
53
  # ----------------------------------------------------------
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  COPY entrypoint.sh /entrypoint.sh
55
  RUN chmod +x /entrypoint.sh
56
 
57
+ # ----------------------------------------------------------
58
+ # 9. Use entrypoint for final startup
59
+ # ----------------------------------------------------------
60
  CMD ["/entrypoint.sh"]
61