vrypt-server / Dockerfile
sanvrypt's picture
Update Dockerfile
0e454c5 verified
Raw
History Blame Contribute Delete
1.76 kB
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"]