App Engine灵活环境-Dockerfile安装过时版本的GDAL

App Engine灵活环境-Dockerfile安装过时版本的GDAL,docker,ubuntu,google-app-engine,dockerfile,gdal,Docker,Ubuntu,Google App Engine,Dockerfile,Gdal,我正试图在Google App Engine Flexible环境中使用Docker图像 FROM ubuntu:bionic MAINTAINER Makina Corpus "contact@makina-corpus.com" ENV PYTHONUNBUFFERED 1 ENV DEBIAN_FRONTEND noninteractive ENV LANG C.UTF-8 RUN apt-get update -qq && apt-get install -y -qq

我正试图在Google App Engine Flexible环境中使用Docker图像

FROM ubuntu:bionic
MAINTAINER Makina Corpus "contact@makina-corpus.com"

ENV PYTHONUNBUFFERED 1
ENV DEBIAN_FRONTEND noninteractive
ENV LANG C.UTF-8

RUN apt-get update -qq && apt-get install -y -qq \
    # std libs
    git less nano curl \
    ca-certificates \
    wget build-essential\
    # python basic libs
    python3.8 python3.8-dev python3.8-venv gettext \
    # geodjango
    gdal-bin binutils libproj-dev libgdal-dev \
    # postgresql
    libpq-dev postgresql-client && \
    apt-get clean all && rm -rf /var/apt/lists/* && rm -rf /var/cache/apt/*

# install pip
RUN wget https://bootstrap.pypa.io/get-pip.py && python3.8 get-pip.py && rm get-pip.py
RUN pip3 install --no-cache-dir setuptools wheel -U

CMD ["/bin/bash"]
docker映像似乎构建正确,但当服务部署应用程序时崩溃,我收到以下错误消息:

  File "/Users/NAME/Documents/gcp/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/operations_util.py", line 183, in IsDone
    encoding.MessageToPyValue(operation.error)))
OperationError: Error Response: [9] 
Application startup error! Code: APP_CONTAINER_CRASHED

ERROR: (gcloud.app.deploy) Error Response: [9] 
Application startup error! Code: APP_CONTAINER_CRASHED
这是失败的,因为Dockerfile正在安装一个明显过时的GDAL包版本,该版本与当前的python安装冲突

如何确保dockerfile具有正确的包存储库,并且正在安装正确的最新版本?在开始安装之前,我是否可以插入一些行来更新存储库,或者至少打印存储库

编辑:

我的app.yaml:

# [START django_app]

runtime: custom
env: flex
entrypoint: gunicorn -b :$PORT MyApplication.wsgi

runtime_config:
  python_version: 3
# [END runtime]

handlers:
# This configures Google App Engine to serve the files in the app's static
# directory.
#- url: /static
#  static_dir: static/
#- url: /MyApplication/static
#  static_dir: MyApplication/static/


# This handler routes all requests not caught above to your main app. It is
# required when static routes are defined, but can be omitted (along with
# the entire handlers section) when there are no static files defined.
- url: /.*
  script: auto
# [END django_app]

resources:
  cpu: 1
  memory_gb: 2
  disk_size_gb: 10

您的应用程序引擎部署失败,因为它无法在云上运行bash。如果需要调试App Engine Flex实例,首先需要在端口8080上获得服务。

类似的问题正在得到解决和解决

Dockerfile应运行一个命令,以启动侦听端口8080的应用程序:

CMD gunicorn -b :$PORT MyApplication.wsgi
GAE实际上使用
docker run
来启动容器,我不确定为什么它们也会在
app.yaml
文件中指定
entrypoint
。最好不要问GAE太多问题

上面的一些评论中提到了您需要考虑的其他问题:

  • 使用谷歌的GAE基础图像(如上面的一些评论中所提到的)->
    从gcr.io/Google appengine/python
    ,不是更好吗
  • 如果是这样,您需要考虑它是基于Ubuntu 16.04的,并且您需要更新依赖关系(通过添加UbuntuGIS PPA:<代码> Apple存储库-Y PPA:UbuntuGIS/PPA)
  • 如何安装其他依赖项?使用需求文件运行
    pip

如果您正在使用python为您的流量提供服务,那么最好使用谷歌图片谢谢!如何确保我的Django应用程序在8080上运行?这是在app.yaml中完成的(我已经编辑了问题以显示我的文件)?我当然更愿意使用谷歌镜像(我只需要确保安装了这些软件包:gdal-bin-binutils-libproj-dev-libgdal-dev)。我是否应该将“FROM ubuntu:bionic”替换为“FROM gcr.io/google appengine/python”?考虑到您将使用Django,我会将我的工作基于中的docker文件,并将中的Django部分合并到中