-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
105 lines (91 loc) · 2.14 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package main
import (
log "github.com/sirupsen/logrus"
// "github.com/zserge/lorca"
// "runtime"
"os"
// "net"
// "net/http"
// "os/signal"
// "fmt"
// "embed"
// "sync"
)
/// go:embed www
// var fs embed.FS
func initLogger() {
// The TextFormatter is default, you don't actually have to do this.
log.SetFormatter(&log.TextFormatter{
ForceColors: true,
DisableLevelTruncation: true,
PadLevelText: true,
FullTimestamp: false,
})
// Output to stdout instead of the default stderr
// Can be any io.Writer, see below for File example
log.SetOutput(os.Stdout)
// Only log the warning severity or above.
log.SetLevel(log.DebugLevel)
}
type install struct {
installLocation string
fileName string
}
type fileContents struct {
// sync.Mutex
baseImage string
installer string
workDir string
installs []install
}
func main() {
initLogger()
log.Info("DockerfileGen starting...")
// args := []string{}
// if runtime.GOOS == "linux" {
// args = append(args, "--class=Lorca")
// }
//
// ui, err := lorca.New("", "", 480, 320, args...)
//
// if err != nil {
// log.Fatal(err)
// }
// defer ui.Close()
//
// ui.Bind("start", func() {
// log.Info("UI is ready")
// })
//
// err = ui.Bind("getBaseImage", func(acBaseImage string) string { return acBaseImage})
// if err != nil {
// log.Fatal("Failed to bind to UI")
// }
//
// path := ui.Eval(`getBaseImage("arch")`).String()
// log.Debug(path)
//
// ln, err := net.Listen("tcp", "127.0.0.1:0")
// if err != nil {
// log.Fatal(err)
// }
// defer ln.Close()
// go http.Serve(ln, http.FileServer(http.FS(fs)))
// ui.Load(fmt.Sprintf("http://%s/www", ln.Addr()))
//
// defer func(ui lorca.UI) {
// err := ui.Close()
// if err != nil {
// log.Fatal("Failed to close UI")
// }
// }(ui)
// Wait for the browser window to be closed
// sigc := make(chan os.Signal)
// signal.Notify(sigc, os.Interrupt)
generateDockerfile()
// select {
// case <-sigc:
// // case <-ui.Done():
// }
log.Info("DockerfileGen exiting...")
}