GoPlayground/Dockerfile

51 lines
1.7 KiB
Docker
Raw Normal View History

2021-10-23 19:51:48 +00:00
FROM golang:1.17.2
WORKDIR /src
2021-11-17 06:32:44 +00:00
RUN \
# gterm \
2021-11-17 17:01:30 +00:00
curl -fsSL https://kumoly.io/attachments/e4bdde2a-4247-446f-a734-df3962c8b83b | tar -C /usr/local/bin/ -xz &&\
2021-11-17 06:32:44 +00:00
# configui \
2021-11-17 18:00:19 +00:00
curl -fsSL https://kumoly.io/attachments/e4258c02-1e79-4969-b553-070668498dd4 | tar -C /usr/local/bin/ -xz &&\
2021-11-17 06:32:44 +00:00
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
2021-11-17 17:10:20 +00:00
RUN touch shell.sh && \
echo '\
2021-11-17 06:32:44 +00:00
:8000 {\n\
route /sh/* {\n\
uri strip_prefix /sh\n\
reverse_proxy localhost:8080\n\
}\n\
reverse_proxy localhost:8001\n\
2021-11-17 18:50:12 +00:00
}' > /Caddyfile && \
2021-11-17 17:10:20 +00:00
echo '\
2021-11-17 17:01:30 +00:00
{{ define "links" }}\n\
<a class="button is-white level-item" \n\
href="sh/"\n\
>Shell</a>\n\
{{end}}\n\
2021-11-17 18:50:12 +00:00
' > /links.tmpl && \
2021-11-17 17:10:20 +00:00
echo 'package main\n\
2021-10-25 04:35:37 +00:00
\n\
import "fmt"\n\
\n\
func main() {\n\
fmt.Println("Hello, world.")\n\
2021-11-17 18:50:12 +00:00
}\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
2021-10-25 04:28:53 +00:00
2021-11-17 17:06:40 +00:00
ENTRYPOINT ["/bin/bash","/entrypoint.sh"]