Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emailservice Image Optimization #51

Merged
merged 10 commits into from
Sep 25, 2018
Merged
15 changes: 4 additions & 11 deletions src/emailservice/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,25 @@
FROM python:2.7-alpine3.8 as base
FROM python:3.7.0-alpine3.8 as base
Copy link
Contributor

@ahmetb ahmetb Sep 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend doing python:3-alpine (or :3.7-alpine) here so that:

  1. we get python 3.x patches
  2. we get stable alpine patches (not edge)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.


FROM base as builder

# gRPC deps
# gRPC and app deps
RUN apk add --update --no-cache \
gcc \
linux-headers \
make \
musl-dev \
python-dev \
g++ \
# App Deps
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


FROM base as final

# Download the grpc health probe
Expand All @@ -40,7 +33,7 @@ ENV PYTHONUNBUFFERED=0
WORKDIR /email_server

# Grab packages from builder
COPY --from=builder /usr/local/lib/python2.7/ /usr/local/lib/python2.7/
COPY --from=builder /usr/local/lib/python3.7/ /usr/local/lib/python3.7/

# Need libstdc++ for grpc
RUN apk add --no-cache libstdc++
Expand Down
11 changes: 6 additions & 5 deletions src/emailservice/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@ configparser==3.5.0
cryptography==2.3.1
entrypoints==0.2.3
enum34==1.1.6
futures==3.2.0
futures==3.1.1
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.15.0
grpcio-health-checking==1.15.0
grpcio-tools==1.15.0
grpcio==1.12.1
grpcio-health-checking==1.14.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally this also should be 1.12.1 but it's probably identical to 1.14.1.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. The previous requirements.txt had it at 1.14.1 so I kept it at that. I'll downgrade it and test

grpcio-tools==1.12.1
idna==2.7
ipaddress==1.0.22
jeepney==0.4
Jinja2==2.10
keyring==15.1.0
keyrings.alt==3.1
Expand All @@ -35,6 +36,6 @@ pytz==2018.5
pyxdg==0.26
requests==2.19.1
rsa==4.0
SecretStorage==2.3.1
SecretStorage==3.1.0
six==1.11.0
urllib3==1.23