build.go 704 B

123456789101112131415161718192021222324252627282930313233
  1. package build
  2. import (
  3. "github.com/docker/docker/api/server/router"
  4. "github.com/docker/docker/api/server/router/local"
  5. "github.com/docker/docker/daemon"
  6. )
  7. // buildRouter is a router to talk with the build controller
  8. type buildRouter struct {
  9. backend *daemon.Daemon
  10. routes []router.Route
  11. }
  12. // NewRouter initializes a new build router
  13. func NewRouter(b *daemon.Daemon) router.Router {
  14. r := &buildRouter{
  15. backend: b,
  16. }
  17. r.initRoutes()
  18. return r
  19. }
  20. // Routes returns the available routers to the build controller
  21. func (r *buildRouter) Routes() []router.Route {
  22. return r.routes
  23. }
  24. func (r *buildRouter) initRoutes() {
  25. r.routes = []router.Route{
  26. local.NewPostRoute("/build", r.postBuild),
  27. }
  28. }