From d97bb6f53eefd2139115d39bca7e17d565222472 Mon Sep 17 00:00:00 2001 From: Clawd Date: Tue, 17 Feb 2026 07:59:50 -0800 Subject: Fix port collision bug, add --container-port flag Port allocation: - Use atomic flock-based allocation via /etc/ship/next_port - Prevents race conditions when multiple deploys run concurrently - Each app still gets its port stored in /etc/ship/ports/ Docker container port: - Add --container-port flag (default 80) - Template now uses {{.ContainerPort}} instead of hardcoded 80 - Supports containers that listen on 8080, 3000, etc. --- cmd/ship/root_v2.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'cmd/ship/root_v2.go') diff --git a/cmd/ship/root_v2.go b/cmd/ship/root_v2.go index 4101d4e..aa81d1e 100644 --- a/cmd/ship/root_v2.go +++ b/cmd/ship/root_v2.go @@ -43,6 +43,7 @@ func initV2() { rootV2Cmd.Flags().String("ttl", "", "Auto-delete after duration (e.g., 1h, 7d)") rootV2Cmd.Flags().StringArray("env", nil, "Environment variable (KEY=VALUE)") rootV2Cmd.Flags().String("env-file", "", "Path to .env file") + rootV2Cmd.Flags().Int("container-port", 80, "Port the container listens on (Docker only)") // Check for SHIP_PRETTY env var if os.Getenv("SHIP_PRETTY") == "1" { @@ -78,6 +79,7 @@ func runDeployV2(cmd *cobra.Command, args []string) error { opts.TTL, _ = cmd.Flags().GetString("ttl") opts.Env, _ = cmd.Flags().GetStringArray("env") opts.EnvFile, _ = cmd.Flags().GetString("env-file") + opts.ContainerPort, _ = cmd.Flags().GetInt("container-port") // deployV2 handles all output and exits deployV2(path, opts) -- cgit v1.2.3