feat: purge cache using herokuish image

In some cases, the cache directory may exist but there may be no app image to use for cache purging. This may be the case if the app was never deployed.

Instead of failing, we can simply use the configured herokuish image for clearing cache, as that image is the base image for anything that would have modified cache.
This commit is contained in:
Jose Diaz-Gonzalez
2019-07-05 16:07:13 -04:00
parent 39f3f598a5
commit 33423a0508
2 changed files with 4 additions and 7 deletions

View File

@@ -6,6 +6,7 @@ import (
"strings"
"github.com/dokku/dokku/plugins/common"
"github.com/dokku/dokku/plugins/config"
)
// deletes the contents of the build cache stored in the repository
@@ -23,7 +24,7 @@ func main() {
cacheDir := strings.Join([]string{common.MustGetEnv("DOKKU_ROOT"), appName, "cache"}, "/")
cacheHostDir := strings.Join([]string{common.MustGetEnv("DOKKU_HOST_ROOT"), appName, "cache"}, "/")
dokkuGlobalRunArgs := common.MustGetEnv("DOKKU_GLOBAL_RUN_ARGS")
image := common.GetDeployingAppImageName(appName, "", "")
image := config.GetWithDefault(appName, "DOKKU_IMAGE", os.Getenv("DOKKU_IMAGE"))
if info, _ := os.Stat(cacheDir); info != nil && info.IsDir() {
purgeCacheCmd := common.NewShellCmd(strings.Join([]string{
common.DockerBin(),