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