Phase 9: containerise & deploy to Portainer
This commit is contained in:
@@ -26,6 +26,11 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
if len(os.Args) > 1 && os.Args[1] == "healthcheck" {
|
||||
runHealthcheck()
|
||||
return
|
||||
}
|
||||
|
||||
cfg := config.Load()
|
||||
|
||||
logger := slog.New(slog.NewJSONHandler(os.Stdout, nil))
|
||||
@@ -127,6 +132,17 @@ func main() {
|
||||
slog.Info("server stopped")
|
||||
}
|
||||
|
||||
func runHealthcheck() {
|
||||
port := os.Getenv("PORT")
|
||||
if port == "" {
|
||||
port = "8080"
|
||||
}
|
||||
resp, err := http.Get("http://localhost:" + port + "/healthz")
|
||||
if err != nil || resp.StatusCode != http.StatusOK {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func ensureIcons(dir string) {
|
||||
for _, size := range []int{192, 512} {
|
||||
path := filepath.Join(dir, fmt.Sprintf("icon-%d.png", size))
|
||||
|
||||
Reference in New Issue
Block a user