Install tini as an ubuntu package

This commit is contained in:
romainx
2021-05-19 09:23:33 +02:00
parent 3fe198a1fd
commit 1c5c2d945a
2 changed files with 17 additions and 8 deletions

View File

@@ -46,6 +46,7 @@ ARG miniforge_checksum="d4065b376f81b83cfef0c7316f97bb83337e4ae27eb988828363a578
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
RUN apt-get -q update && \ RUN apt-get -q update && \
apt-get install -yq --no-install-recommends \ apt-get install -yq --no-install-recommends \
tini \
wget \ wget \
ca-certificates \ ca-certificates \
sudo \ sudo \
@@ -115,10 +116,8 @@ RUN wget --quiet "https://github.com/conda-forge/miniforge/releases/download/${m
conda list python | grep '^python ' | tr -s ' ' | cut -d '.' -f 1,2 | sed 's/$/.*/' >> $CONDA_DIR/conda-meta/pinned && \ conda list python | grep '^python ' | tr -s ' ' | cut -d '.' -f 1,2 | sed 's/$/.*/' >> $CONDA_DIR/conda-meta/pinned && \
conda install --quiet --yes \ conda install --quiet --yes \
"conda=${CONDA_VERSION}" \ "conda=${CONDA_VERSION}" \
'pip' \ 'pip' && \
'tini=0.18.0' && \
conda update --all --quiet --yes && \ conda update --all --quiet --yes && \
conda list tini | grep tini | tr -s ' ' | cut -d ' ' -f 1,2 >> $CONDA_DIR/conda-meta/pinned && \
conda clean --all -f -y && \ conda clean --all -f -y && \
rm -rf /home/$NB_USER/.cache/yarn && \ rm -rf /home/$NB_USER/.cache/yarn && \
fix-permissions $CONDA_DIR && \ fix-permissions $CONDA_DIR && \

View File

@@ -8,11 +8,7 @@ LOGGER = logging.getLogger(__name__)
@pytest.mark.parametrize( @pytest.mark.parametrize(
"env,expected_server", "env,expected_server", [(["JUPYTER_ENABLE_LAB=yes"], "lab"), (None, "notebook"), ],
[
(["JUPYTER_ENABLE_LAB=yes"], "lab"),
(None, "notebook"),
],
) )
def test_start_notebook(container, http_client, env, expected_server): def test_start_notebook(container, http_client, env, expected_server):
"""Test the notebook start-notebook script""" """Test the notebook start-notebook script"""
@@ -31,3 +27,17 @@ def test_start_notebook(container, http_client, env, expected_server):
if not env: if not env:
msg = "WARN: Jupyter Notebook deprecation notice" msg = "WARN: Jupyter Notebook deprecation notice"
assert msg in logs, f"Expected warning message {msg} not printed" assert msg in logs, f"Expected warning message {msg} not printed"
def test_tini_entrypoint(container, pid=1, command="tini"):
"""Check that tini is launched as PID 1
Credits to the following answer for the ps options used in the test:
https://superuser.com/questions/632979/if-i-know-the-pid-number-of-a-process-how-can-i-get-its-name
"""
LOGGER.info(f"Test that {command} is launched as PID {pid} ...")
c = container.run(tty=True, command=["start.sh"])
# Select the PID 1 and get the corresponding command
cmd = c.exec_run(f"ps -p {pid} -o comm=")
output = cmd.output.decode("utf-8").strip("\n")
assert output == command, f"{command} shall be launched as pid {pid}, got {output}"