Update pipelines/dockerfile
Browse files- pipelines/dockerfile +28 -15
pipelines/dockerfile
CHANGED
@@ -1,37 +1,50 @@
|
|
1 |
-
# Use
|
2 |
-
FROM
|
3 |
|
4 |
-
# Use
|
5 |
-
ARG USE_CUDA
|
6 |
-
ARG USE_CUDA_VER
|
7 |
|
8 |
-
## Basis ##
|
9 |
ENV ENV=prod \
|
10 |
PORT=9099 \
|
11 |
-
# pass build args to the build
|
12 |
USE_CUDA_DOCKER=${USE_CUDA} \
|
13 |
USE_CUDA_DOCKER_VER=${USE_CUDA_VER}
|
14 |
|
15 |
-
# Install
|
16 |
RUN apt-get update && \
|
17 |
-
apt-get install -y
|
|
|
18 |
apt-get clean && \
|
19 |
rm -rf /var/lib/apt/lists/*
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
WORKDIR /app
|
22 |
|
|
|
23 |
COPY ./bm25s ./bm25s
|
24 |
-
RUN
|
25 |
-
|
26 |
|
|
|
27 |
COPY ./requirements.txt .
|
28 |
-
|
|
|
|
|
29 |
if [ "$USE_CUDA" = "true" ]; then \
|
30 |
-
|
31 |
else \
|
32 |
-
|
33 |
fi
|
34 |
-
|
|
|
|
|
35 |
|
36 |
# Copy the application code
|
37 |
COPY . .
|
|
|
1 |
+
# Use NVIDIA CUDA 12.0, cuDNN 8, and Ubuntu 22.04 as the base image
|
2 |
+
FROM nvidia/cuda:12.0.0-cudnn8-runtime-ubuntu22.04 AS base
|
3 |
|
4 |
+
# Use arguments to make CUDA version and GPU usage configurable
|
5 |
+
ARG USE_CUDA=true
|
6 |
+
ARG USE_CUDA_VER=cu120
|
7 |
|
8 |
+
## Basis Environment ##
|
9 |
ENV ENV=prod \
|
10 |
PORT=9099 \
|
|
|
11 |
USE_CUDA_DOCKER=${USE_CUDA} \
|
12 |
USE_CUDA_DOCKER_VER=${USE_CUDA_VER}
|
13 |
|
14 |
+
# Install system dependencies including Python 3.11
|
15 |
RUN apt-get update && \
|
16 |
+
apt-get install -y \
|
17 |
+
python3.11 python3.11-venv python3-pip gcc build-essential curl git pkg-config libicu-dev && \
|
18 |
apt-get clean && \
|
19 |
rm -rf /var/lib/apt/lists/*
|
20 |
|
21 |
+
# Set Python 3.11 as default and install pip for Python 3.11
|
22 |
+
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 && \
|
23 |
+
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
|
24 |
+
python3.11 get-pip.py && \
|
25 |
+
update-alternatives --install /usr/bin/pip3 pip3 /usr/local/bin/pip3.11 1 && \
|
26 |
+
rm get-pip.py
|
27 |
+
|
28 |
+
# Work directory
|
29 |
WORKDIR /app
|
30 |
|
31 |
+
# Copy and install bm25s module
|
32 |
COPY ./bm25s ./bm25s
|
33 |
+
RUN pip install ./bm25s
|
|
|
34 |
|
35 |
+
# Copy the requirements file
|
36 |
COPY ./requirements.txt .
|
37 |
+
|
38 |
+
# Install Python dependencies, using CUDA or CPU torch based on build arguments
|
39 |
+
RUN pip install uv && \
|
40 |
if [ "$USE_CUDA" = "true" ]; then \
|
41 |
+
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/${USE_CUDA_DOCKER_VER} --no-cache-dir; \
|
42 |
else \
|
43 |
+
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu --no-cache-dir; \
|
44 |
fi
|
45 |
+
|
46 |
+
# Install other Python dependencies
|
47 |
+
RUN pip install --system -r requirements.txt --no-cache-dir
|
48 |
|
49 |
# Copy the application code
|
50 |
COPY . .
|