container.go RawHistoryFolder
1// Package domain contains pure business types without external dependencies.
2// These types are used throughout the application and have no tags or framework dependencies.
3package domain
4
5// Container represents a running container in the system.
6type Container struct {
7 ID string
8 Image string
9 ImageID string // Docker image ID (sha256 digest) used to detect redundant deploys
10 Name string
11 Status string
12 ExitCode int
13 Ports []int
14 Labels map[string]string
15}
16
17// NetworkInfo represents network configuration and state.
18type NetworkInfo struct {
19 ID string
20 Name string
21 Driver string
22 Containers []string
23 Labels map[string]string
24}
25
26// Attachment represents an attached service container.
27type Attachment struct {
28 Name string
29 Image string
30 ContainerID string
31 Status string
32 Network string
33 Ports []int
34}
35
36// RouteInfo combines route configuration with runtime state.
37type RouteInfo struct {
38 Domain string
39 Image string
40 ContainerID string
41 ContainerStatus string
42 Network string
43 Attachments []Attachment
44}
45
46// ContainerConfig holds configuration for creating a container.
47type ContainerConfig struct {
48 Image string
49 Name string
50 Env []string
51 Ports []int
52 Labels map[string]string
53 WorkingDir string
54 Cmd []string
55 AutoRemove bool
56 Volumes map[string]string // map[containerPath]volumeName
57 ReadOnlyVolumes map[string]string // containerPath -> volumeName (mounted read-only)
58 NetworkMode string // Network to join
59 Hostname string // Container hostname for DNS
60 Aliases []string // Additional network aliases
61 MemoryLimit int64 // Memory limit in bytes (0 = no limit)
62 NanoCPUs int64 // CPU quota in nanoseconds (1e9 = 1 core, 0 = no limit)
63 PidsLimit int64 // Max number of PIDs (0 = no limit)
64}
65
66// ContainerStatus represents the current state of a container.
67type ContainerStatus string
68
69const (
70 ContainerStatusRunning ContainerStatus = "running"
71 ContainerStatusStopped ContainerStatus = "stopped"
72 ContainerStatusCreated ContainerStatus = "created"
73 ContainerStatusExited ContainerStatus = "exited"
74 ContainerStatusPaused ContainerStatus = "paused"
75 ContainerStatusUnknown ContainerStatus = "unknown"
76)