Skip to content

Commit 31a6c9d

Browse files
committed
feat(Dockerfiles): switch from s2i python images to plain ubi/cs9 ones
The main benefit is size and cve exposure, as the python images come with packages we don't use; python and pip is enough for us. Additionally, using plain ubi makes things more explicit.
1 parent 2b77e1c commit 31a6c9d

File tree

3 files changed

+37
-4
lines changed

3 files changed

+37
-4
lines changed

base/c9s-python-3.9/Dockerfile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
FROM quay.io/sclorg/python-39-c9s:c9s
1+
FROM quay.io/centos/centos:stream9
2+
3+
# perform the setup that python image used to do for us
4+
# but this way it uses a lot less disk space (hundreds of megabytes less)
5+
ENV VIRTUAL_ENV="/opt/app-root"
6+
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
7+
RUN useradd --uid 1001 --gid 0 --create-home --base-dir / --home-dir /opt/app-root/src \
8+
--comment "Default Application User" --shell /bin/bash default && \
9+
dnf install -y python3-pip && dnf clean all && rm -rf /var/cache/yum/* && \
10+
python3.9 -m venv "${VIRTUAL_ENV}"
11+
12+
USER 1001
213

314
LABEL name="odh-notebook-base-centos-stream9-python-3.9" \
415
summary="Python 3.9 CentOS Stream 9 base image for ODH notebooks" \

base/ubi9-python-3.11/Dockerfile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
FROM registry.access.redhat.com/ubi9/python-311:latest
1+
FROM registry.access.redhat.com/ubi9/ubi:latest
2+
3+
# perform the setup that python s2i image used to do for us
4+
# but this way it uses a lot less disk space (hundreds of megabytes less)
5+
ENV VIRTUAL_ENV="/opt/app-root"
6+
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
7+
RUN useradd --uid 1001 --gid 0 --create-home --base-dir / --home-dir /opt/app-root/src \
8+
--comment "Default Application User" --shell /bin/bash default && \
9+
dnf install -y python311-pip && dnf clean all && rm -rf /var/cache/yum/* && \
10+
python3.11 -m venv "${VIRTUAL_ENV}"
11+
12+
USER 1001
213

314
LABEL name="odh-notebook-base-ubi9-python-3.11" \
415
summary="Python 3.11 base image for ODH notebooks" \
@@ -18,7 +29,7 @@ RUN pip install --no-cache-dir -U "micropipenv[toml]"
1829
# Install Python dependencies from Pipfile.lock file
1930
COPY Pipfile.lock ./
2031

21-
RUN echo "Installing softwares and packages" && micropipenv install && rm -f ./Pipfile.lock
32+
RUN echo "Installing software and packages" && micropipenv install && rm -f ./Pipfile.lock
2233

2334
# OS Packages needs to be installed as root
2435
USER root

base/ubi9-python-3.9/Dockerfile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
FROM registry.access.redhat.com/ubi9/python-39:latest
1+
FROM registry.access.redhat.com/ubi9/ubi:latest
2+
3+
# perform the setup that python s2i image used to do for us
4+
# but this way it uses a lot less disk space (hundreds of megabytes less)
5+
ENV VIRTUAL_ENV="/opt/app-root"
6+
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
7+
RUN useradd --uid 1001 --gid 0 --create-home --base-dir / --home-dir /opt/app-root/src \
8+
--comment "Default Application User" --shell /bin/bash default && \
9+
dnf install -y python3-pip && dnf clean all && rm -rf /var/cache/yum/* && \
10+
python3.9 -m venv "${VIRTUAL_ENV}"
11+
12+
USER 1001
213

314
LABEL name="odh-notebook-base-ubi9-python-3.9" \
415
summary="Python 3.9 base image for ODH notebooks" \

0 commit comments

Comments
 (0)