emailservice: Reduced Docker image size to ~240 MB. Used multi stage builds and alpine image
This commit is contained in:
parent
6a72e16fdc
commit
ce404756ce
2 changed files with 63 additions and 28 deletions
|
@ -1,27 +1,52 @@
|
|||
FROM python:2.7-alpine3.8 as base
|
||||
|
||||
FROM base as builder
|
||||
|
||||
# gRPC deps
|
||||
RUN apk add --update --no-cache \
|
||||
gcc \
|
||||
linux-headers \
|
||||
make \
|
||||
musl-dev \
|
||||
python-dev \
|
||||
g++ \
|
||||
cairo-dev \
|
||||
cairo \
|
||||
openssl-dev \
|
||||
gobject-introspection-dev
|
||||
|
||||
ENV GRPC_PYTHON_VERSION 1.15.0
|
||||
|
||||
# Install grpcio
|
||||
RUN python -m pip install --upgrade pip
|
||||
RUN pip install grpcio==${GRPC_PYTHON_VERSION} grpcio-tools==${GRPC_PYTHON_VERSION}
|
||||
|
||||
# get packages
|
||||
COPY requirements.txt .
|
||||
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
|
||||
# Use the grpc.io provided Python image as the base image
|
||||
FROM grpc/python:1.0
|
||||
FROM base as final
|
||||
|
||||
# download the grpc health probe
|
||||
# Download the grpc health probe
|
||||
RUN GRPC_HEALTH_PROBE_VERSION=v0.1.0-alpha.1 && \
|
||||
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
|
||||
|
||||
# show python logs as they occur
|
||||
# Show python logs as they occur
|
||||
ENV PYTHONUNBUFFERED=0
|
||||
|
||||
# install pip for python3
|
||||
RUN apt-get -qqy update && \
|
||||
apt-get -qqy install python3-pip
|
||||
|
||||
# get packages
|
||||
WORKDIR /email_server
|
||||
COPY requirements.txt .
|
||||
RUN pip3 install -r requirements.txt
|
||||
|
||||
# Grab packages from builder
|
||||
COPY --from=builder /usr/local/lib/python2.7/ /usr/local/lib/python2.7/
|
||||
|
||||
# Need libstdc++ for grpc
|
||||
RUN apk add --no-cache libstdc++
|
||||
|
||||
# Add the application
|
||||
COPY . .
|
||||
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT [ "python3", "email_server.py" ]
|
||||
ENTRYPOINT [ "python", "email_server.py" ]
|
|
@ -1,31 +1,41 @@
|
|||
drive.web-frontend_20180920.00_p1
|
||||
asn1crypto==0.24.0
|
||||
cachetools==2.1.0
|
||||
certifi==2018.4.16
|
||||
certifi==2018.8.24
|
||||
cffi==1.11.5
|
||||
chardet==3.0.4
|
||||
cryptography==1.7.1
|
||||
google-api-core==1.2.1
|
||||
google-auth==1.5.0
|
||||
configparser==3.5.0
|
||||
cryptography==2.3.1
|
||||
entrypoints==0.2.3
|
||||
enum34==1.1.6
|
||||
futures==3.2.0
|
||||
google-api-core==1.4.0
|
||||
google-auth==1.5.1
|
||||
google-cloud-core==0.28.1
|
||||
google-cloud-trace==0.19.0
|
||||
googleapis-common-protos==1.5.3
|
||||
grpc-google-iam-v1==0.11.4
|
||||
grpcio==1.12.1
|
||||
grpcio-health-checking==1.14.1
|
||||
grpcio-tools==1.12.1
|
||||
grpcio==1.15.0
|
||||
grpcio-health-checking==1.15.0
|
||||
grpcio-tools==1.15.0
|
||||
idna==2.7
|
||||
ipaddress==1.0.22
|
||||
Jinja2==2.10
|
||||
keyring==10.1
|
||||
keyrings.alt==1.3
|
||||
keyring==15.1.0
|
||||
keyrings.alt==3.1
|
||||
MarkupSafe==1.0
|
||||
opencensus==0.1.5
|
||||
protobuf==3.6.0
|
||||
pyasn1==0.4.3
|
||||
opencensus==0.1.7
|
||||
protobuf==3.6.1
|
||||
pyasn1==0.4.4
|
||||
pyasn1-modules==0.2.2
|
||||
pycairo==1.17.1
|
||||
pycparser==2.19
|
||||
pycrypto==2.6.1
|
||||
pygobject==3.22.0
|
||||
PyGObject==3.30.1
|
||||
pytz==2018.5
|
||||
pyxdg==0.25
|
||||
pyxdg==0.26
|
||||
requests==2.19.1
|
||||
rsa==3.4.2
|
||||
rsa==4.0
|
||||
SecretStorage==2.3.1
|
||||
six==1.11.0
|
||||
urllib3==1.23
|
||||
urllib3==1.23
|
Loading…
Add table
Add a link
Reference in a new issue