UNCLASSIFIED - NO CUI

Skip to content
Snippets Groups Projects

Jweatherford refactor

Closed Jeff Weatherford requested to merge jweatherford-refactor into development
3 files
+ 25
117
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 15
73
@@ -2,81 +2,23 @@ ARG BASE_REGISTRY=registry1.dso.mil
ARG BASE_IMAGE=ironbank/redhat/ubi/ubi8
ARG BASE_TAG=8.8
FROM ${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG} as build
RUN dnf upgrade -y --nodocs && \
dnf install -y --nodocs \
bzip2-devel \
expat-devel \
gcc \
libffi-devel \
libuuid-devel \
make \
openssl-devel \
sqlite-devel \
xz-devel && \
dnf clean all && \
rm -rf /var/cache/dnf
COPY python.tar.gz /
RUN mkdir -p /usr/local/src/python && \
tar -zxf python.tar.gz -C /usr/local/src/python --strip-components=1 && \
cd /usr/local/src/python && \
./configure \
--enable-loadable-sqlite-extensions \
--enable-optimizations \
--enable-option-checking=fatal \
--enable-shared \
--with-system-expat \
--with-ensurepip && \
make && \
make altinstall
RUN find /usr/local -depth \
\( \
\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
-o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \
\) -exec rm -rf '{}' + && \
echo '/usr/local/lib' >> /etc/ld.so.conf && \
ldconfig
COPY requirements.txt .
RUN pip3.8 install -r requirements.txt
FROM ${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG}
RUN dnf update -y --nodocs && \
dnf clean all && \
rm -rf /var/cache/dnf
ENV PATH /usr/local/bin:$PATH
COPY --from=build /usr/local/include/python3.8 /usr/local/include/python3.8
COPY --from=build /usr/local/lib /usr/local/lib
COPY --from=build /usr/local/bin /usr/local/bin
RUN cd /usr/local/bin && \
ln -s idle3.8 idle3 && \
ln -s idle3 idle && \
ln -s pydoc3.8 pydoc3 && \
ln -s pydoc3 pydoc && \
ln -s python3.8 python3 && \
ln -s python3 python && \
ln -s python3.8-config python3-config && \
ln -s python3-config python-config && \
ln -s easy_install-3.8 easy_install-3 && \
ln -s easy_install-3 easy_install && \
ln -s 2to3-3.8 2to3-3 && \
ln -s 2to3-3 2to3 && \
ln -s pip3.8 pip3 || true && \
ln -s pip3 pip || true && \
echo '/usr/local/lib' >> /etc/ld.so.conf && \
ldconfig
RUN groupadd -g 1001 python && \
useradd -r -u 1001 -m -s /sbin/nologin -g python python
# DO NOT BUILD FROM SOURCE! CVE patches will come from RH.
# Red Hat will backport any relevant security fixes to the base packages.
# There is no need to build from source and chase dependency hell. Also,
# developers developing against RHEL 8 will be assuming the RHEL versions
# are installed and stable. If the developers want a different version
# of python than ships in the standard repos, they can install it themselves
# in whatever container they are building (and build it off the UBI base).
RUN dnf update && \
dnf upgrade -y --nodocs --allowerasingt; \
dnf -y install --nodocs --allowerasing python3.8; \
dnf clean all; \
rm -rf /var/cache/dnf/*; \
groupadd --gid 1001 python_user; \
useradd -r --uid 1001 -m -s /sbin/nologin -g python_user python_user
USER 1001
CMD ["python3"]
Loading