fix docker image entrypoints (#17105)
Also removes extraneous prompt and ssh handling logic.
This commit is contained in:
@@ -16,29 +16,35 @@ COPY share $SPACK_ROOT/share
|
||||
COPY var $SPACK_ROOT/var
|
||||
RUN mkdir -p $SPACK_ROOT/opt/spack
|
||||
|
||||
RUN apt-get -yqq update \
|
||||
&& apt-get -yqq install --no-install-recommends \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
curl \
|
||||
file \
|
||||
g++ \
|
||||
gcc \
|
||||
gfortran \
|
||||
git \
|
||||
gnupg2 \
|
||||
iproute2 \
|
||||
lmod \
|
||||
locales \
|
||||
lua-posix \
|
||||
make \
|
||||
openssh-server \
|
||||
python3 \
|
||||
python3-pip \
|
||||
tcl \
|
||||
unzip \
|
||||
&& locale-gen en_US.UTF-8 \
|
||||
&& pip3 install boto3 \
|
||||
RUN ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash \
|
||||
/usr/local/bin/docker-shell \
|
||||
&& ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash \
|
||||
/usr/local/bin/interactive-shell \
|
||||
&& ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash \
|
||||
/usr/local/bin/spack-env
|
||||
|
||||
RUN apt-get -yqq update \
|
||||
&& apt-get -yqq install --no-install-recommends \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
curl \
|
||||
file \
|
||||
g++ \
|
||||
gcc \
|
||||
gfortran \
|
||||
git \
|
||||
gnupg2 \
|
||||
iproute2 \
|
||||
lmod \
|
||||
locales \
|
||||
lua-posix \
|
||||
make \
|
||||
python3 \
|
||||
python3-pip \
|
||||
tcl \
|
||||
unzip \
|
||||
&& locale-gen en_US.UTF-8 \
|
||||
&& pip3 install boto3 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Add LANG default to en_US.UTF-8
|
||||
@@ -46,33 +52,10 @@ ENV LANGUAGE en_US.UTF-8
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LC_ALL en_US.UTF-8
|
||||
|
||||
RUN ( echo ". /usr/share/lmod/lmod/init/bash" \
|
||||
&& echo ". \$SPACK_ROOT/share/spack/setup-env.sh" \
|
||||
&& echo "if [ \"\$CURRENTLY_BUILDING_DOCKER_IMAGE\" '!=' '1' ]" \
|
||||
&& echo "then" \
|
||||
&& echo " . \$SPACK_ROOT/share/spack/spack-completion.bash" \
|
||||
&& echo "fi" ) \
|
||||
>> /etc/profile.d/spack.sh \
|
||||
&& ( echo "f=\"\$SPACK_ROOT/share/spack/docker/handle-ssh.sh\"" \
|
||||
&& echo "if [ -f \"\$f\" ]" \
|
||||
&& echo "then" \
|
||||
&& echo " . \"\$f\"" \
|
||||
&& echo "else" \
|
||||
&& cat $SPACK_ROOT/share/spack/docker/handle-ssh.sh \
|
||||
&& echo "fi" ) \
|
||||
>> /etc/profile.d/handle-ssh.sh \
|
||||
&& ( echo "f=\"\$SPACK_ROOT/share/spack/docker/handle-prompt.sh\"" \
|
||||
&& echo "if [ -f \"\$f\" ]" \
|
||||
&& echo "then" \
|
||||
&& echo " . \"\$f\"" \
|
||||
&& echo "else" \
|
||||
&& cat $SPACK_ROOT/share/spack/docker/handle-prompt.sh \
|
||||
&& echo "fi" ) \
|
||||
>> /etc/profile.d/handle-prompt.sh \
|
||||
&& mkdir -p /root/.spack \
|
||||
&& cp $SPACK_ROOT/share/spack/docker/modules.yaml \
|
||||
/root/.spack/modules.yaml \
|
||||
&& rm -rf /root/*.* $SPACK_ROOT/.git
|
||||
RUN mkdir -p /root/.spack \
|
||||
&& cp $SPACK_ROOT/share/spack/docker/modules.yaml \
|
||||
/root/.spack/modules.yaml \
|
||||
&& rm -rf /root/*.* /run/nologin $SPACK_ROOT/.git
|
||||
|
||||
# [WORKAROUND]
|
||||
# https://superuser.com/questions/1241548/
|
||||
@@ -82,10 +65,10 @@ RUN [ -f ~/.profile ] \
|
||||
|| true
|
||||
|
||||
WORKDIR /root
|
||||
SHELL ["/bin/bash", "-l", "-c"]
|
||||
SHELL ["docker-shell"]
|
||||
|
||||
# TODO: add a command to Spack that (re)creates the package cache
|
||||
RUN spack spec hdf5+mpi
|
||||
|
||||
ENTRYPOINT ["/bin/bash", "/opt/spack/share/spack/docker/entrypoint.bash"]
|
||||
CMD ["docker-shell"]
|
||||
CMD ["interactive-shell"]
|
||||
|
Reference in New Issue
Block a user