Sunset Mikoto commited on
Commit
ffa8167
·
1 Parent(s): bc49da4

Setup Tailscale

Browse files
Files changed (2) hide show
  1. Dockerfile +6 -1
  2. deploy-container/entrypoint.sh +5 -0
Dockerfile CHANGED
@@ -29,7 +29,12 @@ RUN sudo chown -R coder:coder /home/coder/.local
29
  # Install apt packages:
30
  # RUN sudo apt-get install -y ubuntu-make
31
 
32
- RUN curl -fsSL https://tailscale.com/install.sh | sh
 
 
 
 
 
33
  RUN sudo mkdir -p --mode=0755 /usr/share/keyrings && \
34
  curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg | sudo tee /usr/share/keyrings/cloudflare-main.gpg >/dev/null && \
35
  echo 'deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared any main' | sudo tee /etc/apt/sources.list.d/cloudflared.list && \
 
29
  # Install apt packages:
30
  # RUN sudo apt-get install -y ubuntu-make
31
 
32
+ # Copy Tailscale binaries from the tailscale image on Docker Hub.
33
+ COPY --from=docker.io/tailscale/tailscale:stable /usr/local/bin/tailscaled /usr/local/bin/tailscaled
34
+ COPY --from=docker.io/tailscale/tailscale:stable /usr/local/bin/tailscale /usr/local/bin/tailscale
35
+ RUN mkdir -p /var/run/tailscale /var/cache/tailscale /var/lib/tailscale
36
+
37
+ # Install cloudflared
38
  RUN sudo mkdir -p --mode=0755 /usr/share/keyrings && \
39
  curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg | sudo tee /usr/share/keyrings/cloudflare-main.gpg >/dev/null && \
40
  echo 'deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared any main' | sudo tee /etc/apt/sources.list.d/cloudflared.list && \
deploy-container/entrypoint.sh CHANGED
@@ -96,9 +96,14 @@ if [ -n "$DOTFILES_REPO" ]; then
96
  fi
97
 
98
  # Setup Tailscale
 
99
  if [ -n "$TS_AUTHKEY" ]; then
 
100
  tailscale up --authkey="${TS_AUTHKEY}?preauthorized=true&ephemeral=true" --hostname=${TS_HOSTNAME} --advertise-exit-node=true --ssh=true --accept-dns --advertise-tags=tag:container
101
  tailscale set --webclient=true --auto-update=true --posture-checking=true
 
 
 
102
  fi
103
 
104
  echo "[$PREFIX] Starting code-server..."
 
96
  fi
97
 
98
  # Setup Tailscale
99
+ # https://tailscale.com/kb/1107/heroku
100
  if [ -n "$TS_AUTHKEY" ]; then
101
+ tailscaled --tun=userspace-networking --socks5-server=localhost:1055 &
102
  tailscale up --authkey="${TS_AUTHKEY}?preauthorized=true&ephemeral=true" --hostname=${TS_HOSTNAME} --advertise-exit-node=true --ssh=true --accept-dns --advertise-tags=tag:container
103
  tailscale set --webclient=true --auto-update=true --posture-checking=true
104
+ echo "[$PREFIX] Tailscale started"
105
+ export ALL_PROXY=socks5://localhost:1055/
106
+ unset TS_AUTHKEY TS_HOSTNAME
107
  fi
108
 
109
  echo "[$PREFIX] Starting code-server..."