#!/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 || cat > /root/.bashrc <<'EOF' export PATH="/root/.bun/bin:$PATH" export HISTFILE=/root/.bash_history export HISTSIZE=10000 EOF fi # Start SSH daemon /usr/sbin/sshd # Start code-server exec code-server \ --bind-addr 0.0.0.0:8080 \ --auth oauth \ --oauth-provider=gitea \ --oauth-client-id="${GITEA_CLIENT_ID}" \ --oauth-client-secret="${GITEA_CLIENT_SECRET}" \ --oauth-scopes="read:user" \ --disable-telemetry \ /root