finish work

This commit is contained in:
2025-04-18 17:40:44 +08:00
parent cc8e04a41f
commit 16e779a450
25 changed files with 483 additions and 651 deletions
+9 -42
View File
@@ -1,32 +1,25 @@
package main
import (
"floares/lib/libpod"
"floares/service/auth"
"floares/service/containers"
"floares/service/images"
"floares/service/network"
"floares/service/system"
"github.com/containers/podman/v5/cmd/podman/registry"
api "github.com/containers/podman/v5/pkg/api/server"
"github.com/containers/podman/v5/pkg/domain/entities"
"github.com/containers/storage/pkg/reexec"
"github.com/spf13/cobra"
"net"
"floares/service/volume"
"github.com/containers/podman/v5/pkg/domain/infra"
"github.com/gin-gonic/gin"
"log"
"net/http"
"github.com/gin-gonic/gin"
)
func main() {
if reexec.Init() {
// We were invoked with a different argv[0] indicating that we
// had a specific job to do as a subprocess, and it's done.
return
}
//if reexec.Init() {
// // We were invoked with a different argv[0] indicating that we
// // had a specific job to do as a subprocess, and it's done.
// return
//}
//c := cobra.Command{}
r := gin.Default()
r.Use(func(c *gin.Context) {
@@ -53,32 +46,6 @@ func main() {
images.RegisterRouter(r.Group("/images"))
network.RegisterRouter(r.Group("/network"))
volume.RegisterRouter(r.Group("/volumes"))
//flags := flag.NewFlagSet("", flag.ExitOnError)
cmd := &cobra.Command{}
cfg := registry.PodmanConfig()
de := cfg.ContainersConfDefaultsRO
de.Engine.OCIRuntime = "youki"
rootFlags(cmd, cfg)
persistentPreRunE(cmd, nil)
log.Println(*cfg)
libpodRuntime, err := infra.GetRuntime(registry.Context(), cmd.PersistentFlags(), cfg)
if err != nil {
log.Fatal(err)
}
listener, err := net.Listen("tcp", "127.0.0.1:8888")
if err != nil {
panic(err)
}
libpodRuntime.SetRemoteURI("tcp://localhost:8888")
infra.StartWatcher(libpodRuntime)
server, err := api.NewServerWithSettings(libpodRuntime, listener, entities.ServiceOptions{
URI: "tcp://localhost:8888",
})
if err != nil {
log.Fatal(err)
}
go server.Serve()
libpod.NewServer()
r.Run()
}