dockerv2
Browse files- Dockerfile +14 -8
Dockerfile
CHANGED
@@ -6,7 +6,9 @@ ENV DEBIAN_FRONTEND=noninteractive
|
|
6 |
|
7 |
# Install system dependencies
|
8 |
RUN apt-get update && apt-get install -y \
|
9 |
-
python3 \
|
|
|
|
|
10 |
python3-pip \
|
11 |
cmake \
|
12 |
build-essential \
|
@@ -18,18 +20,22 @@ RUN useradd -m -u 1000 user
|
|
18 |
# Set the working directory
|
19 |
WORKDIR /app
|
20 |
|
|
|
|
|
|
|
|
|
21 |
# Copy the requirements file
|
22 |
COPY requirements.txt .
|
23 |
|
24 |
# Install Python dependencies
|
25 |
-
RUN
|
26 |
-
|
|
|
27 |
|
28 |
# Install llama-cpp-python with CUDA support
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu121
|
33 |
|
34 |
# Copy the rest of the application code
|
35 |
COPY . .
|
@@ -44,4 +50,4 @@ USER user
|
|
44 |
ENV PATH="/home/user/.local/bin:$PATH"
|
45 |
|
46 |
# Run the application
|
47 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
6 |
|
7 |
# Install system dependencies
|
8 |
RUN apt-get update && apt-get install -y \
|
9 |
+
python3.10 \
|
10 |
+
python3.10-venv \
|
11 |
+
python3.10-dev \
|
12 |
python3-pip \
|
13 |
cmake \
|
14 |
build-essential \
|
|
|
20 |
# Set the working directory
|
21 |
WORKDIR /app
|
22 |
|
23 |
+
# Create and activate virtual environment
|
24 |
+
RUN python3.10 -m venv /app/venv
|
25 |
+
ENV PATH="/app/venv/bin:$PATH"
|
26 |
+
|
27 |
# Copy the requirements file
|
28 |
COPY requirements.txt .
|
29 |
|
30 |
# Install Python dependencies
|
31 |
+
RUN . /app/venv/bin/activate && \
|
32 |
+
pip install --no-cache-dir --upgrade pip && \
|
33 |
+
pip install --no-cache-dir -r requirements.txt
|
34 |
|
35 |
# Install llama-cpp-python with CUDA support
|
36 |
+
RUN . /app/venv/bin/activate && \
|
37 |
+
pip install llama-cpp-python \
|
38 |
+
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu121
|
|
|
39 |
|
40 |
# Copy the rest of the application code
|
41 |
COPY . .
|
|
|
50 |
ENV PATH="/home/user/.local/bin:$PATH"
|
51 |
|
52 |
# Run the application
|
53 |
+
CMD ["/app/venv/bin/uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|