From 6d4ffd6e2176e82e81033adf878cba959817336f Mon Sep 17 00:00:00 2001 From: Clawd Date: Wed, 18 Feb 2026 21:11:48 -0800 Subject: fix: pass container port (not host port) as PORT env var Docker deployments were passing the host port as PORT to the container, but the port mapping routes traffic to container port. This caused apps that read PORT from env to listen on the wrong port inside the container. --- cmd/ship/deploy_impl_v2.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'cmd') diff --git a/cmd/ship/deploy_impl_v2.go b/cmd/ship/deploy_impl_v2.go index ec5c4a3..bfec9d3 100644 --- a/cmd/ship/deploy_impl_v2.go +++ b/cmd/ship/deploy_impl_v2.go @@ -120,8 +120,15 @@ func deployDockerV2(ctx *deployContext) *output.ErrorResponse { return output.Err(output.ErrBuildFailed, err.Error()) } + // Determine container port + containerPort := ctx.Opts.ContainerPort + if containerPort == 0 { + containerPort = 80 + } + // Generate and write env file - envContent := fmt.Sprintf("PORT=%d\nSHIP_NAME=%s\nSHIP_URL=%s\n", port, name, ctx.URL) + // Use containerPort so the app listens on the correct port inside the container + envContent := fmt.Sprintf("PORT=%d\nSHIP_NAME=%s\nSHIP_URL=%s\n", containerPort, name, ctx.URL) for _, e := range ctx.Opts.Env { envContent += e + "\n" } @@ -134,10 +141,6 @@ func deployDockerV2(ctx *deployContext) *output.ErrorResponse { } // Generate systemd unit - containerPort := ctx.Opts.ContainerPort - if containerPort == 0 { - containerPort = 80 - } service, err := templates.DockerService(map[string]string{ "Name": name, "Port": strconv.Itoa(port), -- cgit v1.2.3