@@ -4,15 +4,18 @@ ARG PROTOC_VERSION=25.1
4
4
# ARG PYTORCH_INDEX="https://download.pytorch.org/whl"
5
5
ARG PYTORCH_INDEX="https://download.pytorch.org/whl/nightly"
6
6
ARG PYTORCH_VERSION=2.3.0.dev20231221
7
+ ARG PYTHON_VERSION=3.11
7
8
8
9
# # Base Layer ##################################################################
9
10
FROM registry.access.redhat.com/ubi9/ubi:${BASE_UBI_IMAGE_TAG} as base
10
11
WORKDIR /app
11
12
13
+ ARG PYTHON_VERSION
14
+
12
15
RUN dnf remove -y --disableplugin=subscription-manager \
13
16
subscription-manager \
14
17
# we install newer version of requests via pip
15
- python3.11 -requests \
18
+ python${PYTHON_VERSION} -requests \
16
19
&& dnf install -y make \
17
20
# to help with debugging
18
21
procps \
@@ -128,10 +131,12 @@ RUN cargo install --path .
128
131
# # Tests base ##################################################################
129
132
FROM base as test-base
130
133
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++ && \
132
137
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
135
140
136
141
RUN pip install --upgrade pip --no-cache-dir && pip install pytest --no-cache-dir && pip install pytest-asyncio --no-cache-dir
137
142
@@ -142,7 +147,8 @@ ENV CUDA_VISIBLE_DEVICES=""
142
147
FROM test-base as cpu-tests
143
148
ARG PYTORCH_INDEX
144
149
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
146
152
147
153
WORKDIR /usr/src
148
154
@@ -174,15 +180,20 @@ RUN cd integration_tests && make install
174
180
FROM cuda-devel as python-builder
175
181
ARG PYTORCH_INDEX
176
182
ARG PYTORCH_VERSION
183
+ ARG PYTHON_VERSION
184
+ ARG MINIFORGE_VERSION=23.3.1-1
177
185
178
186
RUN dnf install -y unzip git ninja-build && dnf clean all
179
187
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
184
195
185
- ENV PATH=/opt/miniconda /bin:$PATH
196
+ ENV PATH=/opt/tgis /bin/ :$PATH
186
197
187
198
# Install specific version of torch
188
199
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
244
255
245
256
# # Final Inference Server image ################################################
246
257
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
248
260
249
261
# Install C++ compiler (required at runtime when PT2_COMPILE is enabled)
250
262
RUN dnf install -y gcc-c++ && dnf clean all \
251
263
&& useradd -u 2000 tgis -m -g 0
252
264
253
265
SHELL ["/bin/bash" , "-c" ]
254
266
255
- COPY --from=build /opt/miniconda/ /opt/miniconda/
267
+ COPY --from=build /opt/tgis /opt/tgis
256
268
257
- ENV PATH=/opt/miniconda /bin:$PATH
269
+ ENV PATH=/opt/tgis /bin:$PATH
258
270
259
271
# These could instead come from explicitly cached images
260
272
0 commit comments