compose.go 2.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package models
  2. // AppImportRequest represents a request to import an app from docker-compose
  3. type AppImportRequest struct {
  4. AppName string `json:"app_name,omitempty"` // Optional app name, can be auto-generated
  5. SourceURL string `json:"source_url" binding:"required"` // Git repository URL
  6. Branch string `json:"branch" binding:"required"` // Git branch, defaults to "main"
  7. ComposePath string `json:"compose_path,omitempty"` // Path to docker-compose.yml, defaults to "docker-compose.yml"
  8. }
  9. // ComposeService represents a service found in a docker-compose.yml file
  10. type ComposeService struct {
  11. Name string `json:"name"` // Service name from compose file
  12. Source string `json:"source"` // "build" or "image"
  13. BuildContext string `json:"build_context,omitempty"` // For build services, the context path
  14. Dockerfile string `json:"dockerfile,omitempty"` // For build services, the dockerfile path
  15. Image string `json:"image,omitempty"` // For image services, the image name
  16. Ports []string `json:"ports,omitempty"` // Port mappings
  17. Environment map[string]string `json:"environment,omitempty"` // Environment variables
  18. Volumes []string `json:"volumes,omitempty"` // Volume mappings
  19. }
  20. // AppImportReview represents the review response for an app import
  21. type AppImportReview struct {
  22. AppName string `json:"app_name"` // Suggested or provided app name
  23. Services []ComposeService `json:"services"` // List of services found in compose file
  24. Valid bool `json:"valid"` // Whether the compose file is valid
  25. Error string `json:"error,omitempty"` // Error message if invalid
  26. }
  27. // AppImportCreateRequest represents the final request to create an app from compose
  28. type AppImportCreateRequest struct {
  29. AppImportRequest
  30. ConfirmedAppName string `json:"confirmed_app_name" binding:"required"` // User-confirmed app name
  31. }