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