sanvrypt commited on
Commit
0e454c5
·
verified ·
1 Parent(s): c8d963b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +42 -18
Dockerfile CHANGED
@@ -19,6 +19,7 @@ RUN apt-get update && apt-get install -y \
19
  unzip \
20
  gnupg \
21
  lsb-release \
 
22
  && rm -rf /var/lib/apt/lists/*
23
 
24
  RUN curl -fsSL https://tailscale.com/install.sh | sh
@@ -31,23 +32,46 @@ RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/
31
  sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config && \
32
  sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
33
 
34
- RUN printf '#!/bin/bash\n\
35
- set -e\n\
36
- AUTH_KEY="${TAILSCALE_AUTH_KEY:-tskey-auth-kH3iQLsz2M11CNTRL-W2XXWuwXahQfCgo8GQBFhQJMVj4GRUJaj}"\n\
37
- HOSTNAME="${CONTAINER_HOSTNAME:-vps-container}"\n\
38
- /usr/sbin/sshd\n\
39
- tailscaled --tun=userspace-networking --statedir=/var/lib/tailscale &\n\
40
- TAILSCALED_PID=$!\n\
41
- sleep 2\n\
42
- tailscale up --auth-key="$AUTH_KEY" --hostname="$HOSTNAME" --accept-routes\n\
43
- echo ""\n\
44
- echo "=== Container ready ==="\n\
45
- echo "Tailscale IP: $(tailscale ip -4 2>/dev/null)"\n\
46
- echo "SSH password: root"\n\
47
- echo "======================="\n\
48
- wait $TAILSCALED_PID\n\
49
- ' > /entrypoint.sh && chmod +x /entrypoint.sh
50
-
51
- EXPOSE 22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
  ENTRYPOINT ["/entrypoint.sh"]
 
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
 
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 7860
76
 
77
  ENTRYPOINT ["/entrypoint.sh"]