master
Evan Chen 2021-11-18 02:50:12 +08:00
parent 8894346152
commit 742dda9ae4
1 changed files with 17 additions and 14 deletions

View File

@ -10,14 +10,6 @@ curl -fsSL https://kumoly.io/attachments/e4258c02-1e79-4969-b553-070668498dd4 |
curl -fsSL https://github.com/caddyserver/caddy/releases/download/v2.4.6/caddy_2.4.6_linux_amd64.tar.gz | tar -C /usr/local/bin/ -xz
RUN touch shell.sh && \
echo '#!/bin/bash\n\
echo "starting shell service..."\n\
gterm -profile > /.profile\n\
cd /root && gterm -addr :8080 -name GoPlayground -arg "--rcfile" -arg /.profile &\n\
echo "starting configui..."\n\
configui -log configui.log -f conf.json -bind :8001 &\n\
caddy run --config Caddyfile\n\
' > /entrypoint.sh && \
echo '\
:8000 {\n\
route /sh/* {\n\
@ -25,23 +17,34 @@ echo '\
reverse_proxy localhost:8080\n\
}\n\
reverse_proxy localhost:8001\n\
}' > Caddyfile && \
}' > /Caddyfile && \
echo '\
{{ define "links" }}\n\
<a class="button is-white level-item" \n\
href="sh/"\n\
>Shell</a>\n\
{{end}}\n\
' > links.tmpl && \
echo '{"app_name":"Go Playground","no_reconfig":true,"shell": "sh" \
,"files":[{"path":"main.go","name":"Main","action":"go run main.go","order":-1},{"path":"shell.sh","name":"Shell","action":"bash shell.sh","order":1}] \
,"hide_config":true,"cust":"."}' > conf.json && \
' > /links.tmpl && \
echo 'package main\n\
\n\
import "fmt"\n\
\n\
func main() {\n\
fmt.Println("Hello, world.")\n\
}\n' > main.go
}\n' > main.go && \
echo '#!/bin/bash\n\
echo "starting shell service..."\n\
gterm -profile > /.profile\n\
cd /root && gterm -addr :8080 -name GoPlayground -arg "--rcfile" -arg /.profile &\n\
echo "starting configui..."\n\
echo "setup config ..."\n\
echo "{\"app_name\":\"Go Playground\",\"no_reconfig\":true,\"shell\": \"bash\",\"hide_config\":true,\"cust\":\"/\",\"files\":[\
" > /conf.json \n\
for f in *.go;do if [ "$f" != "main.go" ] ; then echo "{\"path\":\"$f\"},">>/conf.json;fi done \n\
echo "{\"path\":\"main.go\",\"name\":\"Main\",\"action\":\"go run main.go\",\"order\":-1},">>/conf.json \n\
echo "{\"path\":\"shell.sh\",\"name\":\"Shell\",\"action\":\"bash shell.sh\",\"order\":1}]}">>/conf.json \n\
configui -f /conf.json -bind :8001 &\n\
caddy run --config /Caddyfile\n\
' > /entrypoint.sh
ENTRYPOINT ["/bin/bash","/entrypoint.sh"]