Skip to content

Commit

Permalink
Dockerfile cloud ports (#1148)
Browse files Browse the repository at this point in the history
* explicitly expose ports 8888 and 22

* support for SSH_KEY from latitude
  • Loading branch information
winglian authored Jan 19, 2024
1 parent 08b8ba0 commit 729740d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docker/Dockerfile-cloud
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ ENV TRANSFORMERS_CACHE="/workspace/data/huggingface-cache/hub"
ENV HF_HOME="/workspace/data/huggingface-cache/hub"
ENV HF_HUB_ENABLE_HF_TRANSFER="1"

EXPOSE 8888
EXPOSE 22

COPY scripts/cloud-entrypoint.sh /root/cloud-entrypoint.sh

RUN pip install jupyterlab notebook && \
Expand Down
12 changes: 11 additions & 1 deletion scripts/cloud-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,24 @@ echo 'source /etc/rp_environment' >> ~/.bashrc

if [[ $PUBLIC_KEY ]]
then
# runpod
mkdir -p ~/.ssh
chmod 700 ~/.ssh
echo $PUBLIC_KEY >> ~/.ssh/authorized_keys
chmod 700 -R ~/.ssh
# Start the SSH service in the background
service ssh start
elif [[ $SSH_KEY ]]
then
# latitude.sh
mkdir -p ~/.ssh
chmod 700 ~/.ssh
echo $SSH_KEY >> ~/.ssh/authorized_keys
chmod 700 -R ~/.ssh
# Start the SSH service in the background
service ssh start
else
echo "No PUBLIC_KEY ENV variable provided, not starting openSSH daemon"
echo "No PUBLIC_KEY or SSH_KEY environment variable provided, not starting openSSH daemon"
fi

# Check if JUPYTER_PASSWORD is set and not empty
Expand Down

0 comments on commit 729740d

Please sign in to comment.