同じ問題が発生しました。
For best results, we recommend the following:
- Create a separate directory in your app's directory for each service.
- Each service's directory should contain the service's app.yaml file and one or more .go files.
- Do not include any subdirectories in a service's directory.
- Your GOPATH should specify a directory that is outside your app's directory and contain all the dependencies that your app imports.
しかし、これは次のようになります私のプロジェクト構造、台無し:myproject
ディレクトリをgitのプロジェクトであるとvendor
フォルダがすべて含まれてい
GOPATH/
└── src
└── github.com
└── username
└── myproject
├── app.yaml
├── cmd
│ └── myproject
│ └── main.go
├── handlers
│ └── api.go
├── mw
│ ├── auth.go
│ └── logger.go
└── vendor
をdocs Googleは、以下のことを示唆しているで 依存関係。まず、main.go
ファイルが(同じドキュメントからの)同じディレクトリおよび第二ではないので はapp.yaml
ファイルの命が動作しないmyproject
ディレクトリからgcloud deploy
を実行:
you must be careful not to place your source code at or below your app's directory where the app.yaml file is located
私を構築している私は何をやってしまいました代わりに独自のカスタムランタイムを使用していましたが、これは非常にきれいな解決策でした。
は、単に次のコマンドでDockerfile
を生成:
gcloud beta app gen-config --custom
をごapp.yaml
でruntime: custom
を指定し、通常は展開した後、それを変更します。
ここでのトリックはもちろん、どこにコピーされるのかを制御していることです。ここで
は私Dockerfile
です:
# Dockerfile extending the generic Go image with application files for a
# single application.
FROM gcr.io/google-appengine/golang
ENV GOPATH /go
# The files which are copied are specified in the .dockerignore file
COPY . /go/src/github.com/username/myproject/
WORKDIR /go/src/github.com/username/myproject/
RUN go build -o dist/bin/myproject ./cmd/myproject
# All configuration parameters are passed through environment variables and specified in app.yaml
CMD ["/go/src/github.com/username/myproject/dist/bin/myproject"]
App Engineは、アプリケーションがより多くの詳細については、Building Custom Runtimesドキュメントをチェックアウトポート8080でリッスンして期待していることを忘れないでください。
これまで私はこの問題を見てきましたが、通常はビルドしていたリポジトリのすべてのベンダーディレクトリが適切に設定されていることを確認して解決しました。このエラーが発生するコマンドは何ですか? – Aaron
エラーはdev_appserver.pyからのものです。ベンダーのディレクトリが正しく設定されていないと仮定するのは合理的ですが、手がかりはありますか?それは私には大丈夫だと私たちのunittestsは問題なく実行されます。 – emidander
私が理解しているように、 'go-app-builder'ツールはApp Engine固有のビルドを容易にするために、標準goツールと少し違って動作するので、動作に不一致があるのかもしれません。使用しているSDKのバージョンは何ですか? – Aaron