简体   繁体   English

Heroku Buildpack 目录在编译步骤中创建后丢失

[英]Heroku Buildpack directory missing after creation in compile step

I have a buildpack make to compile enchant dictionaries, and it's having issues having the directory persisting after the dyno deployment.我有一个 buildpack make 来编译附魔字典,并且在 dyno 部署后目录存在问题。

Below is the relevant snippet.下面是相关的片段。

DEFAULT_DIR_ENCHANT_DICTS="/app/.enchant/myspell"
mkdir -p $DEFAULT_DIR_ENCHANT_DICTS
cd /app/.enchant/myspell
echo $PWD

I've confirmed that the directory is created during this compile via cd since it fails otherwise, and printed it after changing to it.我已经确认该目录是在此编译期间通过cd创建的,否则会失败,并在更改为该目录后将其打印出来。 However after deployment, doing heroku run bash on the app and then trying to visit the directory shows that it hasn't actually be created.但是在部署之后,执行heroku run bash然后尝试访问该目录表明它实际上并没有被创建。

I suspect this has something to do with heroku being ephemeral, and hence not keeping these changes, but I haven't been able to find any documentation on securing directories from being wipe before deployment.我怀疑这与 heroku 是短暂的有关,因此没有保留这些更改,但我无法找到任何有关在部署前保护目录不被擦除的文档。

Interestingly, I create this folder as well:有趣的是,我也创建了这个文件夹:

"/app/.heroku/python/lib/python3.6/site-packages/enchant/share/enchant/myspell"

which doesn't get wiped, leading me to believe that certain folders don't get wiped;不会被擦除,这让我相信某些文件夹不会被擦除; however, enchant requires the files to be in this specific location in order to be detected, since it seems to not detect them via site-packages folder currently.但是,附魔要求文件位于此特定位置才能被检测到,因为它目前似乎无法通过site-packages文件夹检测到它们。

I think you'll want to create the dir somewhere other than /app .我想你会想在/app以外的地方创建目录。 That's because when the buildpack runs, it's done in a temp dir.那是因为当 buildpack 运行时,它是在一个临时目录中完成的。 For most purposes the dir you want is pwd .对于大多数目的,您想要的目录是pwd You're buildpack might look like this:你的 buildpack 可能看起来像这样:

DEFAULT_DIR_ENCHANT_DICTS="$(pwd)/.enchant/myspell"
mkdir -p $DEFAULT_DIR_ENCHANT_DICTS
cd .enchant/myspell
echo $PWD

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM