Skip to content

Commit 6a4e7c9

Browse files
prashantgupta24tjohnson31415
authored andcommitted
♻️ replace miniconda with mamba
* ♻️ replace miniconda with mamba Signed-off-by: Prashant Gupta <[email protected]> * ♻️ use miniforge instead Signed-off-by: Prashant Gupta <[email protected]> * 🐛 fix site packages Signed-off-by: Prashant Gupta <[email protected]> * 🔥 remove unused var Signed-off-by: Prashant Gupta <[email protected]> * ♻️ use ARG PYTHON_VERSION Signed-off-by: Prashant Gupta <[email protected]> * Apply suggestions from code review Signed-off-by: Prashant Gupta <[email protected]> Co-authored-by: TRAVIS JOHNSON <[email protected]> * Activate right env path Signed-off-by: Prashant Gupta <[email protected]> Co-authored-by: TRAVIS JOHNSON <[email protected]>
1 parent 8e4f35c commit 6a4e7c9

File tree

1 file changed

+25
-13
lines changed

1 file changed

+25
-13
lines changed

Dockerfile

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,18 @@ ARG PROTOC_VERSION=25.1
44
#ARG PYTORCH_INDEX="https://download.pytorch.org/whl"
55
ARG PYTORCH_INDEX="https://download.pytorch.org/whl/nightly"
66
ARG PYTORCH_VERSION=2.3.0.dev20231221
7+
ARG PYTHON_VERSION=3.11
78

89
## Base Layer ##################################################################
910
FROM registry.access.redhat.com/ubi9/ubi:${BASE_UBI_IMAGE_TAG} as base
1011
WORKDIR /app
1112

13+
ARG PYTHON_VERSION
14+
1215
RUN dnf remove -y --disableplugin=subscription-manager \
1316
subscription-manager \
1417
# we install newer version of requests via pip
15-
python3.11-requests \
18+
python${PYTHON_VERSION}-requests \
1619
&& dnf install -y make \
1720
# to help with debugging
1821
procps \
@@ -128,10 +131,12 @@ RUN cargo install --path .
128131
## Tests base ##################################################################
129132
FROM base as test-base
130133

131-
RUN dnf install -y make unzip python3.11 python3.11-pip gcc openssl-devel gcc-c++ && \
134+
ARG PYTHON_VERSION
135+
136+
RUN dnf install -y make unzip python${PYTHON_VERSION} python${PYTHON_VERSION}-pip gcc openssl-devel gcc-c++ && \
132137
dnf clean all && \
133-
ln -fs /usr/bin/python3.11 /usr/bin/python3 && \
134-
ln -s /usr/bin/python3.11 /usr/local/bin/python && ln -s /usr/bin/pip3.11 /usr/local/bin/pip
138+
ln -fs /usr/bin/python${PYTHON_VERSION} /usr/bin/python3 && \
139+
ln -s /usr/bin/python${PYTHON_VERSION} /usr/local/bin/python && ln -s /usr/bin/pip${PYTHON_VERSION} /usr/local/bin/pip
135140

136141
RUN pip install --upgrade pip --no-cache-dir && pip install pytest --no-cache-dir && pip install pytest-asyncio --no-cache-dir
137142

@@ -142,7 +147,8 @@ ENV CUDA_VISIBLE_DEVICES=""
142147
FROM test-base as cpu-tests
143148
ARG PYTORCH_INDEX
144149
ARG PYTORCH_VERSION
145-
ARG SITE_PACKAGES=/usr/local/lib/python3.11/site-packages
150+
ARG PYTHON_VERSION
151+
ARG SITE_PACKAGES=/usr/local/lib/python${PYTHON_VERSION}/site-packages
146152

147153
WORKDIR /usr/src
148154

@@ -174,15 +180,20 @@ RUN cd integration_tests && make install
174180
FROM cuda-devel as python-builder
175181
ARG PYTORCH_INDEX
176182
ARG PYTORCH_VERSION
183+
ARG PYTHON_VERSION
184+
ARG MINIFORGE_VERSION=23.3.1-1
177185

178186
RUN dnf install -y unzip git ninja-build && dnf clean all
179187

180-
RUN cd ~ && \
181-
curl -L -O https://repo.anaconda.com/miniconda/Miniconda3-py311_23.10.0-1-Linux-x86_64.sh && \
182-
chmod +x Miniconda3-*-Linux-x86_64.sh && \
183-
bash ./Miniconda3-*-Linux-x86_64.sh -bf -p /opt/miniconda
188+
RUN curl -fsSL -v -o ~/miniforge3.sh -O "https://github.com/conda-forge/miniforge/releases/download/${MINIFORGE_VERSION}/Miniforge3-$(uname)-$(uname -m).sh" && \
189+
chmod +x ~/miniforge3.sh && \
190+
bash ~/miniforge3.sh -b -p /opt/conda && \
191+
source "/opt/conda/etc/profile.d/conda.sh" && \
192+
conda create -y -p /opt/tgis python=${PYTHON_VERSION} && \
193+
conda activate /opt/tgis && \
194+
rm ~/miniforge3.sh
184195

185-
ENV PATH=/opt/miniconda/bin:$PATH
196+
ENV PATH=/opt/tgis/bin/:$PATH
186197

187198
# Install specific version of torch
188199
RUN pip install ninja==1.11.1.1 --no-cache-dir
@@ -244,17 +255,18 @@ COPY --from=flash-att-v2-builder /usr/src/flash-attention-v2/build /usr/src/flas
244255

245256
## Final Inference Server image ################################################
246257
FROM cuda-runtime as server-release
247-
ARG SITE_PACKAGES=/opt/miniconda/lib/python3.11/site-packages
258+
ARG PYTHON_VERSION
259+
ARG SITE_PACKAGES=/opt/tgis/lib/python${PYTHON_VERSION}/site-packages
248260

249261
# Install C++ compiler (required at runtime when PT2_COMPILE is enabled)
250262
RUN dnf install -y gcc-c++ && dnf clean all \
251263
&& useradd -u 2000 tgis -m -g 0
252264

253265
SHELL ["/bin/bash", "-c"]
254266

255-
COPY --from=build /opt/miniconda/ /opt/miniconda/
267+
COPY --from=build /opt/tgis /opt/tgis
256268

257-
ENV PATH=/opt/miniconda/bin:$PATH
269+
ENV PATH=/opt/tgis/bin:$PATH
258270

259271
# These could instead come from explicitly cached images
260272

0 commit comments

Comments
 (0)