Spaces:
Paused
Paused
File size: 1,761 Bytes
c8d963b c08e5f4 c8d963b c08e5f4 c8d963b 0e454c5 c8d963b c08e5f4 c8d963b c08e5f4 c8d963b 0e454c5 c8d963b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | FROM debian:12-slim
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
openssh-server \
curl \
wget \
sudo \
iproute2 \
iptables \
ca-certificates \
procps \
net-tools \
vim \
nano \
htop \
git \
unzip \
gnupg \
lsb-release \
nginx \
&& rm -rf /var/lib/apt/lists/*
RUN curl -fsSL https://tailscale.com/install.sh | sh
RUN mkdir -p /run/sshd /var/run/tailscale /var/lib/tailscale /var/cache/tailscale
RUN echo 'root:root' | chpasswd
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config && \
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config && \
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
RUN cat > /etc/nginx/sites-available/default << 'EOF'
server {
listen 7680;
root /var/www/html;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}
EOF
RUN echo '<h1>vps-container</h1>' > /var/www/html/index.html
RUN cat > /entrypoint.sh << 'EOF'
#!/bin/bash
set -e
AUTH_KEY="${TAILSCALE_AUTH_KEY:-tskey-auth-kH3iQLsz2M11CNTRL-W2XXWuwXahQfCgo8GQBFhQJMVj4GRUJaj}"
HOSTNAME="${CONTAINER_HOSTNAME:-vps-container}"
/usr/sbin/sshd
nginx -g 'daemon off;' &
tailscaled --tun=userspace-networking --statedir=/var/lib/tailscale &
TAILSCALED_PID=$!
sleep 2
tailscale up --auth-key="$AUTH_KEY" --hostname="$HOSTNAME" --accept-routes
echo ""
echo "=== Container ready ==="
echo "Tailscale IP: $(tailscale ip -4 2>/dev/null)"
echo "SSH password: root"
echo "HTTP port : 7680"
echo "======================="
wait $TAILSCALED_PID
EOF
RUN chmod +x /entrypoint.sh
EXPOSE 7860
ENTRYPOINT ["/entrypoint.sh"]
|