1
0
mirror of https://github.com/pocket-id/pocket-id.git synced 2026-02-11 17:03:58 +00:00

feat: distroless container additional variant + healthcheck command (#716)

This commit is contained in:
Alessandro (Ale) Segala
2025-07-04 12:26:01 -07:00
committed by GitHub
parent 81315790a8
commit 1a41b05f60
9 changed files with 157 additions and 19 deletions

View File

@@ -1,12 +1,14 @@
package cmds
import (
"context"
"log/slog"
"os"
"github.com/spf13/cobra"
"github.com/pocket-id/pocket-id/backend/internal/bootstrap"
"github.com/pocket-id/pocket-id/backend/internal/utils/signals"
)
var rootCmd = &cobra.Command{
@@ -15,7 +17,7 @@ var rootCmd = &cobra.Command{
Long: "By default, this command starts the pocket-id server.",
Run: func(cmd *cobra.Command, args []string) {
// Start the server
err := bootstrap.Bootstrap()
err := bootstrap.Bootstrap(cmd.Context())
if err != nil {
slog.Error("Failed to run pocket-id", "error", err)
os.Exit(1)
@@ -24,7 +26,10 @@ var rootCmd = &cobra.Command{
}
func Execute() {
err := rootCmd.Execute()
// Get a context that is canceled when the application is stopping
ctx := signals.SignalContext(context.Background())
err := rootCmd.ExecuteContext(ctx)
if err != nil {
os.Exit(1)
}