diff options
Diffstat (limited to 'cmd/ship/deploy_impl_v2.go')
| -rw-r--r-- | cmd/ship/deploy_impl_v2.go | 13 |
1 files changed, 8 insertions, 5 deletions
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 { | |||
| 120 | return output.Err(output.ErrBuildFailed, err.Error()) | 120 | return output.Err(output.ErrBuildFailed, err.Error()) |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | // Determine container port | ||
| 124 | containerPort := ctx.Opts.ContainerPort | ||
| 125 | if containerPort == 0 { | ||
| 126 | containerPort = 80 | ||
| 127 | } | ||
| 128 | |||
| 123 | // Generate and write env file | 129 | // Generate and write env file |
| 124 | envContent := fmt.Sprintf("PORT=%d\nSHIP_NAME=%s\nSHIP_URL=%s\n", port, name, ctx.URL) | 130 | // Use containerPort so the app listens on the correct port inside the container |
| 131 | envContent := fmt.Sprintf("PORT=%d\nSHIP_NAME=%s\nSHIP_URL=%s\n", containerPort, name, ctx.URL) | ||
| 125 | for _, e := range ctx.Opts.Env { | 132 | for _, e := range ctx.Opts.Env { |
| 126 | envContent += e + "\n" | 133 | envContent += e + "\n" |
| 127 | } | 134 | } |
| @@ -134,10 +141,6 @@ func deployDockerV2(ctx *deployContext) *output.ErrorResponse { | |||
| 134 | } | 141 | } |
| 135 | 142 | ||
| 136 | // Generate systemd unit | 143 | // Generate systemd unit |
| 137 | containerPort := ctx.Opts.ContainerPort | ||
| 138 | if containerPort == 0 { | ||
| 139 | containerPort = 80 | ||
| 140 | } | ||
| 141 | service, err := templates.DockerService(map[string]string{ | 144 | service, err := templates.DockerService(map[string]string{ |
| 142 | "Name": name, | 145 | "Name": name, |
| 143 | "Port": strconv.Itoa(port), | 146 | "Port": strconv.Itoa(port), |
