From a9e91c7cf7fe1efea528a8822275a8fa6e1d7238 Mon Sep 17 00:00:00 2001 From: Caroline Date: Tue, 21 Nov 2023 23:58:53 -0500 Subject: [PATCH 1/3] [wip] conda docker env for testing --- .../docker/slim/public-key-auth/Dockerfile | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/runhouse/docker/slim/public-key-auth/Dockerfile b/runhouse/docker/slim/public-key-auth/Dockerfile index c7a23dbdf..f6a233dd6 100644 --- a/runhouse/docker/slim/public-key-auth/Dockerfile +++ b/runhouse/docker/slim/public-key-auth/Dockerfile @@ -1,5 +1,4 @@ -# Debian based image (should work for Ubuntu as well) using public key authentication -FROM python:3.9.15-slim +FROM continuumio/miniconda3:22.11.1 ARG RUNHOUSE_PATH ARG RUNHOUSE_VERSION @@ -8,9 +7,21 @@ WORKDIR /app COPY . . +ENV PATH /opt/conda/bin/:$PATH + +# Conda init +RUN . /root/.bashrc && \ + conda init bash && \ + conda activate base + # Create the password file directory RUN mkdir -p /app/ssh +# Make RUN commands use the conda base environment +RUN echo "conda activate base" >> ~/.bashrc && \ + pip install --upgrade pip +SHELL ["/bin/bash", "--login", "-c"] + # Install the required packages RUN apt-get update --allow-insecure-repositories && \ apt-get install -y --no-install-recommends gcc python3-dev openssh-server rsync supervisor screen curl sudo ufw && \ @@ -21,6 +32,7 @@ RUN apt-get update --allow-insecure-repositories && \ COPY $RUNHOUSE_PATH /app/runhouse # If using a local version of runhouse, install it from the local directory +RUN conda install grpcio RUN if [ -d "/app/runhouse" ]; then pip install -U -e '/app/runhouse[opentelemetry]'; else pip install -U 'runhouse[opentelemetry]==$RUNHOUSE_VERSION'; fi # Create the privilege separation directory required by sshd @@ -29,6 +41,9 @@ RUN mkdir -p /run/sshd # Create a user for SSH access and add to sudo group RUN useradd -m rh-docker-user && echo "rh-docker-user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/rh-docker-user +# Set the path for the user +RUN echo 'export PATH="/opt/conda/bin:/home/rh-docker-user/.local/bin:$PATH"' >> /home/rh-docker-user/.bashrc + # Create .ssh directory for the user RUN mkdir -p /home/rh-docker-user/.ssh From cd22856247abbb1010a4a6a6e3340cb0c544537c Mon Sep 17 00:00:00 2001 From: DenisYay <144945856+DenisYay@users.noreply.github.com> Date: Thu, 7 Dec 2023 11:34:44 -0500 Subject: [PATCH 2/3] Rearrange dependencies and installs in Dockerfile * Install python3-pip * SHELL /bin/bash --login -c before RUN activate base * pip install cryptography and pyopenssl --- runhouse/docker/slim/public-key-auth/Dockerfile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/runhouse/docker/slim/public-key-auth/Dockerfile b/runhouse/docker/slim/public-key-auth/Dockerfile index f6a233dd6..fa5eeaf36 100644 --- a/runhouse/docker/slim/public-key-auth/Dockerfile +++ b/runhouse/docker/slim/public-key-auth/Dockerfile @@ -17,17 +17,18 @@ RUN . /root/.bashrc && \ # Create the password file directory RUN mkdir -p /app/ssh -# Make RUN commands use the conda base environment -RUN echo "conda activate base" >> ~/.bashrc && \ - pip install --upgrade pip -SHELL ["/bin/bash", "--login", "-c"] - # Install the required packages RUN apt-get update --allow-insecure-repositories && \ - apt-get install -y --no-install-recommends gcc python3-dev openssh-server rsync supervisor screen curl sudo ufw && \ + apt-get install -y --no-install-recommends gcc python3-dev python3-pip openssh-server rsync supervisor screen curl sudo ufw && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +# Make RUN commands use the conda base environment +SHELL ["/bin/bash", "--login", "-c"] +RUN echo "conda activate base" >> ~/.bashrc && \ + pip install pip --upgrade && \ + pip install cryptography pyopenssl --upgrade + # COPY local Runhouse package into the image if provided COPY $RUNHOUSE_PATH /app/runhouse From 7e91930aa0f60ed248a0fa246c974770e91e5178 Mon Sep 17 00:00:00 2001 From: DenisYay Date: Thu, 7 Dec 2023 11:36:13 -0500 Subject: [PATCH 3/3] Update the verification instructions for the slim Dockerfile --- runhouse/docker/slim/public-key-auth/instructions.md | 1 + 1 file changed, 1 insertion(+) diff --git a/runhouse/docker/slim/public-key-auth/instructions.md b/runhouse/docker/slim/public-key-auth/instructions.md index 45a2141d8..001a32c5c 100644 --- a/runhouse/docker/slim/public-key-auth/instructions.md +++ b/runhouse/docker/slim/public-key-auth/instructions.md @@ -29,4 +29,5 @@ docker run --rm --shm-size=4gb -it -p 32300:32300 -p 6379:6379 -p 52365:52365 -p 6. Verify via SSH +ssh-keygen -R localhost ssh -i ~/.ssh/runhouse/docker/id_rsa rh-docker-user@localhost