Last active
February 7, 2019 11:24
-
-
Save phroggyy/de04bd421c165d5216a188ee37a65589 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
docker ps --format "{{.Names}} {{ .Ports }}" | sed -e 's/_/-/g' | perl -n -e'/^([\w-]+).+:(\d+)->(\d+)/ && print "{\"name\":\"$1\",\"host\":\"$2\",\"container\":\"$3\"}\n"' | jq -r -s 'map(select(.container == "80")) | map(.name + ".test:443 {\n tls self_signed\n proxy / 127.0.0.1:" + .host + "\n}\n") | .[]' > Caddyfile | |
caddy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment