DownloadDockerCompose gets the docker-compose binary and puts it into ~/.ddev/.bin
()
| 257 | // DownloadDockerCompose gets the docker-compose binary and puts it into |
| 258 | // ~/.ddev/.bin |
| 259 | func DownloadDockerCompose() error { |
| 260 | globalBinDir := globalconfig.GetDDEVBinDir() |
| 261 | destFile, _ := globalconfig.GetDockerComposePath() |
| 262 | |
| 263 | composeURL, shasumURL, err := dockerComposeDownloadLink() |
| 264 | if err != nil { |
| 265 | return err |
| 266 | } |
| 267 | util.Debug("Downloading '%s' to '%s' ...", composeURL, destFile) |
| 268 | |
| 269 | _ = os.Remove(destFile) |
| 270 | |
| 271 | _ = os.MkdirAll(globalBinDir, 0777) |
| 272 | err = util.DownloadFile(destFile, composeURL, globalconfig.IsInteractive(), shasumURL) |
| 273 | if err != nil { |
| 274 | _ = os.Remove(destFile) |
| 275 | return err |
| 276 | } |
| 277 | output.UserErr.Printf("Download complete.") |
| 278 | |
| 279 | // Remove the cached DockerComposeVersion |
| 280 | globalconfig.DockerComposeVersion = "" |
| 281 | |
| 282 | err = util.Chmod(destFile, 0755) |
| 283 | if err != nil { |
| 284 | return err |
| 285 | } |
| 286 | |
| 287 | return nil |
| 288 | } |
| 289 | |
| 290 | // dockerComposeDownloadLink returns the URL and SHASUM-file link for docker-compose |
| 291 | func dockerComposeDownloadLink() (composeURL string, shasumURL string, err error) { |
no test coverage detected