Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Conda docker env for testing #168

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions runhouse/docker/slim/public-key-auth/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
DenisYay marked this conversation as resolved.
Show resolved Hide resolved

ARG RUNHOUSE_PATH
ARG RUNHOUSE_VERSION
Expand All @@ -8,19 +7,33 @@ 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

# 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

# If using a local version of runhouse, install it from the local directory
RUN conda install grpcio
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can probably go above line 34

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
Expand All @@ -29,6 +42,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

Expand Down
1 change: 1 addition & 0 deletions runhouse/docker/slim/public-key-auth/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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