App Engine会忽略指向目录的符号链接 [英] App engine ignores symlinks to directories

查看:59
本文介绍了App Engine会忽略指向目录的符号链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个使用自定义Flex环境在Google App Engine上运行的应用程序.此应用程序使用几个(相对)符号链接,这些符号链接指向项目中的其他目录.但是在部署应用程序时,这些符号链接会以某种方式被忽略.

I'm creating an app which runs on Google's App Engine with the custom flex environment. This app uses several (relative) symlinks which point to other directories in the project. But somehow those symlinks are ignored when I deploy the app.

在构建和部署应用程序之前,gcloud工具似乎将源上下文(即我项目中的所有文件)发送到google容器构建器:

It seems that the gcloud tool sends the source context (which is, all the files in my project) to the google container builder before building and deploying the app:

$ gcloud --project=my-project --verbosity=info app deploy
(...)
Beginning deployment of service [default]...
Building and pushing image for service [default]
INFO: Uploading [/tmp/tmpZ4Jha_/src.tgz] to [eu.gcr.io/my-project/appengine/default.20171212t160803:latest]
Started cloud build [some-uid].

如果我提取.tgz文件的内容,则可以看到项目中的所有文件和目录都在那里.除了指向目录的符号链接(包括指向文件的符号链接).因此,源上下文缺少到目录的所有符号链接.

If I extract the contents of the .tgz file I can see that all the files and directories in the project are there. Except for symlinks pointing to directories (symlinks to files are included though). So the source context is missing all the symlinks to directories.

不使用符号链接不是一种选择,那么有人知道如何在发送到google的源上下文中包括指向目录的符号链接吗?

Not using symlinks is not an option, so does anybody know how to include symlinks to directories in the source context send to google?

尽管我认为这无关紧要,但这是app.yaml的内容:

Although I don't think it's relevant, here are the contents of the app.yaml:

env: flex
runtime: custom

runtime_config:
  document_root: docroot

manual_scaling:
  instances: 1

resources:
  cpu: 2
  memory_gb: 2
  disk_size_gb: 10

推荐答案

我通过从temp目录部署python云功能,并使用tar(在Mac上)将文件包含在符号链接目录中来解决了这个问题:

I've worked around this by deploying my python cloud functions from a temp directory, and using tar (on a Mac) to include files inside symlinked directories:

  tar hc --exclude='__pycache__' {name} | tar x -C {tmpdirname}

这篇关于App Engine会忽略指向目录的符号链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆