Spaces:
Sleeping
Sleeping
| FROM ubuntu:22.04 | |
| # 1. 必要なツールを全部入れる(python3を追加だぜ) | |
| RUN apt-get update && apt-get install -y curl nbd-server openssh-server python3 && apt-get clean | |
| # 2. Tailscaleをインストール | |
| RUN curl -fsSL https://tailscale.com/install.sh | sh | |
| # 3. 16GBの領域確保 | |
| RUN truncate -s 16G /tmp/memory_pool | |
| # 4. SSHの設定 | |
| RUN mkdir /var/run/sshd && \ | |
| echo 'root:noppo' | chpasswd && \ | |
| sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config && \ | |
| sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config | |
| # 5. NBDの設定ファイル | |
| RUN mkdir -p /etc/nbd-server && \ | |
| echo '[generic]\n user = root\n group = root\n[export]\n exportname = /tmp/memory_pool\n port = 7861' > /etc/nbd-server/config | |
| # 6. 起動:偽のWebサーバー(ポート7860)とNBD(ポート7861)を両方動かすぜ | |
| # Hugging Faceは7860に反応があれば満足するんだ | |
| CMD tailscaled --tun=userspace-networking & \ | |
| sleep 5 && \ | |
| tailscale up --authkey=${TAILSCALE_AUTHKEY} --hostname=hf-server && \ | |
| /usr/sbin/sshd && \ | |
| nbd-server -C /etc/nbd-server/config & \ | |
| echo "Starting fake web server on 7860..." && \ | |
| python3 -m http.server 7860 |