generation.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package models
  2. // DockerfileData holds the common data for any Dockerfile template.
  3. // Specific templates might embed this or use a more specific struct.
  4. type DockerfileData struct {
  5. AppPort int
  6. AppName string
  7. }
  8. // GolangDockerfileData holds data specific to the Go Dockerfile template.
  9. type GolangDockerfileData struct {
  10. DockerfileData // Embed common fields
  11. GoVersion string
  12. StaticDir string // Optional: path to static assets to be copied
  13. }
  14. // NodejsDockerfileData holds data specific to the Node.js Dockerfile template.
  15. type NodejsDockerfileData struct {
  16. DockerfileData // Embed common fields
  17. NodeVersion string
  18. BuildArgs string // Optional: arguments for npm run build
  19. BuildOutputDir string // Optional: output directory of the build step (e.g., "dist", "build")
  20. Entrypoint string // e.g., "server.js" or "dist/index.js"
  21. }
  22. // ComposeVolumeData defines a volume mapping for docker-compose.
  23. type ComposeVolumeData struct {
  24. HostPath string
  25. ContainerPath string
  26. ReadOnly bool
  27. }
  28. // ComposeData holds data for the docker-compose.yml template.
  29. type ComposeData struct {
  30. ServiceName string
  31. ImageName string // Full image name, e.g., your-registry.com/app-name:tag
  32. HostPort int // Port exposed on the host machine
  33. AppPort int // Port the application inside the container listens on
  34. Environment map[string]string
  35. Volumes []ComposeVolumeData
  36. Domain string // Domain for Traefik routing
  37. CertResolver string // Traefik certificate resolver name
  38. ExtraTraefikLabels map[string]string // For any additional Traefik labels
  39. }