abanm commited on
Commit
c56ebec
·
verified ·
1 Parent(s): 0c172ff

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +60 -61
Dockerfile CHANGED
@@ -1,61 +1,60 @@
1
- # ----------------------------------------------------------
2
- # 1. Base image
3
- # ----------------------------------------------------------
4
- FROM ubuntu:22.04
5
-
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
- # 3. Install Ollama
24
- # Check https://github.com/jmorganca/ollama/releases for the latest version
25
- # ----------------------------------------------------------
26
- ARG OLLAMA_VERSION="v0.0.14"
27
- RUN wget -q \
28
- https://github.com/jmorganca/ollama/releases/download/${OLLAMA_VERSION}/ollama-linux-x64 \
29
- -O /usr/local/bin/ollama && \
30
- chmod +x /usr/local/bin/ollama
31
-
32
- # ----------------------------------------------------------
33
- # 4. Copy Python requirements and install
34
- # ----------------------------------------------------------
35
- WORKDIR /app
36
- COPY requirements.txt /app/requirements.txt
37
- RUN pip3 install --no-cache-dir -r requirements.txt
38
-
39
- # ----------------------------------------------------------
40
- # 5. Copy application files
41
- # ----------------------------------------------------------
42
- COPY app.py /app/app.py
43
-
44
- # ----------------------------------------------------------
45
- # 6. Environment variables & expose port
46
- # ----------------------------------------------------------
47
- # By default, set an example API key (override at runtime/Secrets)
48
- ENV OLLAMA_API_KEY=change_me
49
-
50
- # We must expose 7860 for Hugging Face Spaces
51
- EXPOSE 7860
52
-
53
- # ----------------------------------------------------------
54
- # 7. Start Ollama in background and then run the FastAPI server
55
- # ----------------------------------------------------------
56
- # The model is pulled from HF: abanm/Dubs-Q8_0-GGUF
57
- #
58
- # "ollama serve" runs on default port 11411. We'll run that in the background,
59
- # then run uvicorn on 7860.
60
- CMD [ "sh", "-c", "ollama serve --model https://huggingface.co/abanm/Dubs-Q8_0-GGUF & uvicorn app:app --host 0.0.0.0 --port 7860" ]
61
- "https://huggingface.co/your-account/your-model"]
 
1
+ # ----------------------------------------------------------
2
+ # 1. Base image
3
+ # ----------------------------------------------------------
4
+ FROM ubuntu:22.04
5
+
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
+ # 3. Install Ollama
24
+ # Check https://github.com/jmorganca/ollama/releases for the latest version
25
+ # ----------------------------------------------------------
26
+ ARG OLLAMA_VERSION="v0.0.14"
27
+ RUN wget -q \
28
+ https://github.com/jmorganca/ollama/releases/download/${OLLAMA_VERSION}/ollama-linux-x64 \
29
+ -O /usr/local/bin/ollama && \
30
+ chmod +x /usr/local/bin/ollama
31
+
32
+ # ----------------------------------------------------------
33
+ # 4. Copy Python requirements and install
34
+ # ----------------------------------------------------------
35
+ WORKDIR /app
36
+ COPY requirements.txt /app/requirements.txt
37
+ RUN pip3 install --no-cache-dir -r requirements.txt
38
+
39
+ # ----------------------------------------------------------
40
+ # 5. Copy application files
41
+ # ----------------------------------------------------------
42
+ COPY app.py /app/app.py
43
+
44
+ # ----------------------------------------------------------
45
+ # 6. Environment variables & expose port
46
+ # ----------------------------------------------------------
47
+ # By default, set an example API key (override at runtime/Secrets)
48
+ ENV OLLAMA_API_KEY=change_me
49
+
50
+ # We must expose 7860 for Hugging Face Spaces
51
+ EXPOSE 7860
52
+
53
+ # ----------------------------------------------------------
54
+ # 7. Start Ollama in background and then run the FastAPI server
55
+ # ----------------------------------------------------------
56
+ # The model is pulled from HF: abanm/Dubs-Q8_0-GGUF
57
+ #
58
+ # "ollama serve" runs on default port 11411. We'll run that in the background,
59
+ # then run uvicorn on 7860.
60
+ CMD [ "sh", "-c", "ollama serve --model https://huggingface.co/abanm/Dubs-Q8_0-GGUF & uvicorn app:app --host 0.0.0.0 --port 7860" ]