updated emailservice Dockerfile

This commit is contained in:
Hamid Asaadi 2018-10-28 14:03:24 -04:00
parent 626b8d0f41
commit ebb2547093
3 changed files with 30 additions and 28 deletions

View file

@ -1,45 +1,48 @@
FROM debian:stretch as base FROM python:3-alpine as base
ENV d = 1
FROM base as builder
# gRPC and app deps # gRPC and app deps
RUN apt-get update RUN apk add --update --no-cache \
gcc \
RUN apt-get install -q -y --no-install-recommends \ linux-headers \
git cmake curl \ make \
python-dev python-setuptools python-pip \ musl-dev \
build-essential zlib1g-dev libbz2-dev \ python-dev \
libreadline-dev libsqlite3-dev wget curl \ g++ \
llvm libncurses5-dev libncursesw5-dev \ # App Deps
xz-utils tk-dev libffi-dev \ cairo-dev \
libssl-dev musl-dev libgirepository1.0-dev libcairo-dev cairo \
openssl-dev \
# Python gobject-introspection-dev
ENV PYENV_SHA256 df9449f69918c716e688d4216eb4398d2cd6d2dcd0f7e6f56d55d19d74cc57cc
RUN curl -L https://github.com/pyenv/pyenv/archive/v1.2.6.tar.gz -o pyenv.tar.gz
RUN echo $PYENV_SHA256 pyenv.tar.gz | sha256sum -c
RUN tar zxvf pyenv.tar.gz
RUN mv pyenv-* pyenv
RUN pyenv/plugins/python-build/install.sh
RUN python-build 3.7.0 /usr/local/
RUN rm /usr/local/bin/python
# get packages # get packages
RUN pip install --upgrade pip
COPY requirements.txt . COPY requirements.txt .
RUN pip install -r requirements.txt RUN pip install -r requirements.txt
COPY google_python_cloud_debugger-2.9-py3.7-linux-x86_64.egg .
RUN easy_install google_python_cloud_debugger-2.9-py3.7-linux-x86_64.egg
FROM base as final
# Enable unbuffered logging
ENV PYTHONUNBUFFERED=1
# Download the grpc health probe # Download the grpc health probe
RUN GRPC_HEALTH_PROBE_VERSION=v0.2.0 && \ RUN GRPC_HEALTH_PROBE_VERSION=v0.2.0 && \
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \ wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \
chmod +x /bin/grpc_health_probe chmod +x /bin/grpc_health_probe
# Enable unbuffered logging
ENV PYTHONUNBUFFERED=1
WORKDIR /email_server WORKDIR /email_server
# Grab packages from builder
COPY --from=builder /usr/local/lib/python3.7/ /usr/local/lib/python3.7/
# Need libstdc++ for grpc
RUN apk add --no-cache libstdc++
# Add the application # Add the application
COPY . . COPY . .
EXPOSE 8080 EXPOSE 8080
ENTRYPOINT [ "python3", "email_server.py" ] ENTRYPOINT [ "python", "email_server.py" ]

View file

@ -12,7 +12,6 @@ google-api-core==1.4.0
google-auth==1.5.1 google-auth==1.5.1
google-cloud-core==0.28.1 google-cloud-core==0.28.1
google-cloud-trace==0.19.0 google-cloud-trace==0.19.0
google-python-cloud-debugger==2.9
googleapis-common-protos==1.5.3 googleapis-common-protos==1.5.3
grpc-google-iam-v1==0.11.4 grpc-google-iam-v1==0.11.4
grpcio==1.12.1 grpcio==1.12.1