Files
lunarfront-app/entrypoint-devpod.sh
Ryan Moon cc5ab41da4
All checks were successful
Build Devpod / build (push) Successful in 8s
Build & Release / build (push) Successful in 16s
fix: enable PermitRootLogin for SSH key access
2026-04-04 09:49:29 -05:00

56 lines
1.1 KiB
Bash

#!/bin/bash
set -e
# Generate SSH host keys if not present
ssh-keygen -A
# Write authorized keys from env if provided
if [ -n "$SSH_AUTHORIZED_KEYS" ]; then
mkdir -p /root/.ssh
chmod 700 /root/.ssh
echo "$SSH_AUTHORIZED_KEYS" > /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
fi
# Bootstrap home dir on fresh PVC
if [ ! -f /root/.bashrc ]; then
cp /etc/skel/.bashrc /root/.bashrc 2>/dev/null || true
cat >> /root/.bashrc <<'EOF'
export PATH="/root/.bun/bin:$PATH"
export HISTFILE=/root/.bash_history
export HISTSIZE=10000
EOF
fi
if [ ! -f /root/.profile ]; then
cat > /root/.profile <<'EOF'
export PATH="/root/.bun/bin:$PATH"
[ -f /root/.bashrc ] && . /root/.bashrc
EOF
fi
if [ ! -f /root/.gitconfig ]; then
cat > /root/.gitconfig <<'EOF'
[user]
name = ryan
email = ryan@lunartech.com
[init]
defaultBranch = main
[core]
editor = code --wait
EOF
fi
# Allow root login via SSH key
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
# Start SSH daemon
/usr/sbin/sshd
# Start code-server
exec code-server \
--bind-addr 0.0.0.0:8080 \
--auth none \
--disable-telemetry \
/root