получить Dockerfile для Google App Engine python 3 - PullRequest
0 голосов
/ 24 марта 2020

Я разрабатываю python веб-сервер в Google App Engine.

Я хочу отладить его в VScode, поэтому я хочу получить Dockerfile для последней версии python 3 в gcr.io. / google-appengine / python

Где его взять?

Ответы [ 2 ]

0 голосов
/ 24 марта 2020

Вот файл Docker, который вы можете использовать:

FROM gcr.io/google-appengine/python

# Create a virtualenv for dependencies. This isolates these packages from
# system-level packages.
# Use -p python3 or -p python3.7 to select python version. Default is version 2.
RUN virtualenv /env

# Setting these environment variables are the same as running
# source /env/bin/activate.
ENV VIRTUAL_ENV /env
ENV PATH /env/bin:$PATH

# Copy the application's requirements.txt and run pip to install all
# dependencies into the virtualenv.
ADD requirements.txt /app/requirements.txt
RUN pip install -r /app/requirements.txt

# Add the application source code.
ADD . /app
WORKDIR /app
# Run a WSGI server to serve the application. gunicorn must be declared as
# a dependency in requirements.txt.

ENTRYPOINT ["gunicorn", "-b", ":8080", "server:app"]

Вы также можете посмотреть в Github Repository

0 голосов
/ 24 марта 2020

Это github репо Python Runtime для App Engine Flex, в этом хранилище вы можете найти Dockerfile и все сценарии для создания контейнера Docker, аналогичного используемому в приложении Двигатель Flex

# The Google App Engine base image is debian (jessie) with ca-certificates
# installed.
# Source: https://github.com/GoogleCloudPlatform/debian-docker
FROM ${OS_BASE_IMAGE}

ADD resources /resources
ADD scripts /scripts

# Install Python, pip, and C dev libraries necessary to compile the most popular
# Python libraries.
RUN /scripts/install-apt-packages.sh

# Setup locale. This prevents Python 3 IO encoding issues.
ENV LANG C.UTF-8
# Make stdout/stderr unbuffered. This prevents delay between output and cloud
# logging collection.
ENV PYTHONUNBUFFERED 1

RUN wget https://storage.googleapis.com/python-interpreters/latest/interpreter-3.4.tar.gz && \
    wget https://storage.googleapis.com/python-interpreters/latest/interpreter-3.5.tar.gz && \
    wget https://storage.googleapis.com/python-interpreters/latest/interpreter-3.6.tar.gz && \
    wget https://storage.googleapis.com/python-interpreters/latest/interpreter-3.7.tar.gz && \
    tar -xzf interpreter-3.4.tar.gz && \
    tar -xzf interpreter-3.5.tar.gz && \
    tar -xzf interpreter-3.6.tar.gz && \
    tar -xzf interpreter-3.7.tar.gz && \
    rm interpreter-*.tar.gz

# Add Google-built interpreters to the path
ENV PATH /opt/python3.7/bin:/opt/python3.6/bin:/opt/python3.5/bin:/opt/python3.4/bin:$PATH
RUN update-alternatives --install /usr/local/bin/python3 python3 /opt/python3.7/bin/python3.7 50 && \
    update-alternatives --install /usr/local/bin/pip3 pip3 /opt/python3.7/bin/pip3.7 50

# Upgrade pip (debian package version tends to run a few version behind) and
# install virtualenv system-wide.
RUN /usr/bin/pip install --upgrade -r /resources/requirements.txt && \
    /opt/python3.4/bin/pip3.4 install --upgrade -r /resources/requirements.txt && \
    rm -f /opt/python3.4/bin/pip /opt/python3.4/bin/pip3 && \
    /opt/python3.5/bin/pip3.5 install --upgrade -r /resources/requirements.txt && \
    rm -f /opt/python3.5/bin/pip /opt/python3.5/bin/pip3 && \
    /opt/python3.6/bin/pip3.6 install --upgrade -r /resources/requirements.txt && \
    rm -f /opt/python3.6/bin/pip /opt/python3.6/bin/pip3 && \
    /opt/python3.7/bin/pip3.7 install --upgrade -r /resources/requirements.txt && \
    rm -f /opt/python3.7/bin/pip /opt/python3.7/bin/pip3 && \
    /usr/bin/pip install --upgrade -r /resources/requirements-virtualenv.txt

# Setup the app working directory
RUN ln -s /home/vmagent/app /app
WORKDIR /app

# Port 8080 is the port used by Google App Engine for serving HTTP traffic.
EXPOSE 8080
ENV PORT 8080

# The user's Dockerfile must specify an entrypoint with ENTRYPOINT or CMD.
CMD []

...