fix(docker): ensure 'chown' does not break on read-only fs; fixes #6264

This commit is contained in:
Eugene Brodsky 2024-06-24 16:57:43 -04:00
parent 42c2dea202
commit 4313578d8e

View File

@ -23,18 +23,18 @@ usermod -u ${USER_ID} ${USER} 1>/dev/null
# but it is useful to have the full SSH server e.g. on Runpod. # but it is useful to have the full SSH server e.g. on Runpod.
# (use SCP to copy files to/from the image, etc) # (use SCP to copy files to/from the image, etc)
if [[ -v "PUBLIC_KEY" ]] && [[ ! -d "${HOME}/.ssh" ]]; then if [[ -v "PUBLIC_KEY" ]] && [[ ! -d "${HOME}/.ssh" ]]; then
apt-get update apt-get update
apt-get install -y openssh-server apt-get install -y openssh-server
pushd "$HOME" pushd "$HOME"
mkdir -p .ssh mkdir -p .ssh
echo "${PUBLIC_KEY}" > .ssh/authorized_keys echo "${PUBLIC_KEY}" >.ssh/authorized_keys
chmod -R 700 .ssh chmod -R 700 .ssh
popd popd
service ssh start service ssh start
fi fi
mkdir -p "${INVOKEAI_ROOT}" mkdir -p "${INVOKEAI_ROOT}"
chown --recursive ${USER} "${INVOKEAI_ROOT}" chown --recursive ${USER} "${INVOKEAI_ROOT}" || true
cd "${INVOKEAI_ROOT}" cd "${INVOKEAI_ROOT}"
# Run the CMD as the Container User (not root). # Run the CMD as the Container User (not root).