1
1
# # Global Args ######################################################
2
- ARG BASE_UBI_IMAGE_TAG=latest
3
- ARG PYTHON_VERSION=3.11
2
+ ARG IMAGE_TAG=1-77.1729776556
3
+ ARG PYTHON_VERSION=311
4
4
5
5
# use UBI9 latest
6
- FROM registry.access.redhat.com/ubi9/ubi :${BASE_UBI_IMAGE_TAG } AS base
6
+ FROM registry.access.redhat.com/ubi9/python-${PYTHON_VERSION} :${IMAGE_TAG } AS base
7
7
8
8
LABEL name="training:py311-cuda121-torch241" \
9
9
summary="CUDA 12.1 Python 3.11 PyTorch 2.4.1 image based on UBI9 for Training" \
@@ -16,24 +16,18 @@ LABEL name="training:py311-cuda121-torch241" \
16
16
COPY LICENSE.md /licenses/cuda-license.md
17
17
18
18
# Set the working directory in the container
19
+ USER 0
19
20
WORKDIR /app
20
21
21
- # remove subscription-manager and install python3.11
22
- RUN dnf remove -y --disableplugin=subscription-manager \
23
- subscription-manager \
24
- && dnf install -y python${PYTHON_VERSION} procps g++ python${PYTHON_VERSION}-devel \
25
- && python -m ensurepip --upgrade \
26
- && python -m pip install --upgrade pip \
27
- && python -m pip install --upgrade setuptools \
28
- && dnf update -y \
29
- && dnf clean all
30
-
31
- RUN dnf remove -y python3-requests && \
32
- pip install --no-cache-dir requests==2.32.3
22
+ # upgrade requests package
23
+ RUN pip install --no-cache-dir --upgrade requests==2.32.3
33
24
34
25
# # CUDA Base ###################################################################
35
26
FROM base AS cuda-base
36
27
28
+ # Install CUDA
29
+ WORKDIR /opt/app-root/bin
30
+
37
31
# Ref: https://docs.nvidia.com/cuda/archive/12.1.0/cuda-toolkit-release-notes/
38
32
ENV CUDA_VERSION=12.1.0 \
39
33
NV_CUDA_LIB_VERSION=12.1.0-1 \
@@ -106,3 +100,7 @@ RUN pip install --no-cache-dir -U "micropipenv[toml]"
106
100
COPY Pipfile.lock ./
107
101
108
102
RUN micropipenv install && rm -f ./Pipfile.lock
103
+
104
+ # Restore user workspace
105
+ USER 1001
106
+ WORKDIR /opt/app-root/src
0 commit comments