Skip to content

Commit

Permalink
infra: reduce RUNs in the base dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
AbeCoull authored Oct 8, 2024
1 parent 5cffdd7 commit dfdb615
Showing 1 changed file with 17 additions and 21 deletions.
38 changes: 17 additions & 21 deletions base/jobs/docker/1.0/py3/Dockerfile.cpu
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ LABEL major_version="1"
ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN true

ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PYTHONIOENCODING=UTF-8
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PYTHONIOENCODING=UTF-8 \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8

ARG PYTHON=python3.10
ARG PYTHON_PIP=python3-pip
Expand All @@ -37,10 +37,9 @@ RUN apt-get update \
zlib1g-dev \
# Install dependent library for OpenCV
libgtk2.0-dev \
&& rm -rf /var/lib/apt/lists/*

&& rm -rf /var/lib/apt/lists/* \
# Install Open MPI
RUN mkdir /tmp/openmpi \
&& mkdir /tmp/openmpi \
&& cd /tmp/openmpi \
&& curl -fSsL -O https://download.open-mpi.org/release/open-mpi/v4.0/openmpi-4.0.4.tar.gz \
&& tar zxf openmpi-4.0.4.tar.gz \
Expand All @@ -49,19 +48,17 @@ RUN mkdir /tmp/openmpi \
&& make -j $(nproc) all \
&& make install \
&& ldconfig \
&& rm -rf /tmp/openmpi

&& rm -rf /tmp/openmpi \
# Create a wrapper for OpenMPI to allow running as root by default
RUN mv /usr/local/bin/mpirun /usr/local/bin/mpirun.real \
&& mv /usr/local/bin/mpirun /usr/local/bin/mpirun.real \
&& echo '#!/bin/bash' > /usr/local/bin/mpirun \
&& echo 'mpirun.real --allow-run-as-root "$@"' >> /usr/local/bin/mpirun \
&& chmod a+x /usr/local/bin/mpirun

RUN echo "hwloc_base_binding_policy = none" >> /usr/local/etc/openmpi-mca-params.conf \
&& echo "hwloc_base_binding_policy = none" >> /usr/local/etc/openmpi-mca-params.conf \
&& echo "rmaps_base_mapping_policy = slot" >> /usr/local/etc/openmpi-mca-params.conf

ENV LD_LIBRARY_PATH=/usr/local/openmpi/lib:/usr/local/lib:$LD_LIBRARY_PATH
ENV PATH /usr/local/openmpi/bin/:$PATH
ENV LD_LIBRARY_PATH=/usr/local/openmpi/lib:/usr/local/lib:$LD_LIBRARY_PATH \
PATH /usr/local/openmpi/bin/:$PATH

# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
Expand All @@ -85,18 +82,17 @@ RUN apt-get update \
libssl-dev \
tk-dev \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean

# Installing Python3
RUN wget https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz \
&& apt-get clean \
# Installing Python3
&& wget https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz \
&& tar -xvf Python-$PYTHON_VERSION.tgz \
&& cd Python-$PYTHON_VERSION \
&& ./configure && make && make install \
&& rm -rf ../Python-$PYTHON_VERSION*

# Upgrading pip and creating symbolic link for python3
RUN ${PIP} --no-cache-dir install --upgrade pip setuptools
RUN ln -s $(which ${PYTHON}) /usr/local/bin/python \
RUN ${PIP} --no-cache-dir install --upgrade pip setuptools \
&& ln -s $(which ${PYTHON}) /usr/local/bin/python \
&& ln -s $(which ${PIP}) /usr/bin/pip

WORKDIR /
Expand Down

0 comments on commit dfdb615

Please sign in to comment.