├── Dockerfile ├── nginx.conf └── supergrok.sh /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine 2 | RUN apk add --no-cache curl nginx 3 | RUN curl https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip >/tmp/ngrok.zip && \ 4 | unzip -d /usr/local/bin /tmp/ngrok.zip && \ 5 | rm -f /tmp/ngrok.zip 6 | RUN curl -L https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 >/usr/local/bin/jq && \ 7 | chmod +x /usr/local/bin/jq 8 | COPY nginx.conf /etc/nginx/nginx.conf 9 | COPY supergrok.sh /bin/supergrok.sh 10 | CMD ["supergrok.sh"] 11 | -------------------------------------------------------------------------------- /nginx.conf: -------------------------------------------------------------------------------- 1 | worker_processes 1; 2 | 3 | pid /run/nginx.pid; 4 | 5 | error_log /error.log; 6 | 7 | events { 8 | worker_connections 1024; 9 | } 10 | 11 | http { 12 | keepalive_timeout 65; 13 | server { 14 | access_log /access.log; 15 | listen 80; 16 | server_name localhost; 17 | location ~ /(?[0-9.:]+)(?.*) { 18 | rewrite /[0-9.:]+/.* $containeruri break; 19 | rewrite /[0-9.:]+ / break; 20 | proxy_pass http://$containeraddrport; 21 | proxy_redirect / /$containeraddrport/; 22 | } 23 | #location / { 24 | # proxy_pass http://pwd; 25 | #} 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /supergrok.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo "Starting NGINX." 3 | nginx 4 | echo "Starting ngrok." 5 | ngrok http 80 --log /ngrok.log >/dev/null & 6 | echo "Waiting for tunnel URL..." 7 | while true; do 8 | URL=$(curl -s localhost:4040/api/tunnels | jq -r .tunnels[0].public_url) 9 | [ "$URL" == "null" ] && continue 10 | [ "$URL" ] && break 11 | sleep 1 12 | done 13 | cat <