From 9a57b398e014562a551d73209d6ddac9277c0d7e Mon Sep 17 00:00:00 2001 From: Steyn Huizinga Date: Wed, 3 Feb 2021 15:07:58 +0100 Subject: [PATCH] Optimize docker image --- Dockerfile | 52 ++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8b2b64b..3bf2082 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,48 @@ -FROM alpine:3.5 +FROM python:3-alpine -RUN apk add --update-cache py3-pip ca-certificates py3-certifi py3-lxml\ - python3-dev cython cython-dev libusb-dev build-base \ - eudev-dev linux-headers libffi-dev openssl-dev \ - jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev \ - tiff-dev tk-dev tcl-dev +ENV REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt COPY setup.py README.rst requirements.txt /build/ -RUN pip3 install -r /build/requirements.txt - COPY aws_google_auth /build/aws_google_auth -RUN pip3 install -e /build/[u2f] -ENV REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt +RUN apk add --update --no-cache \ + ca-certificates \ + libxml2 \ + libxslt \ + eudev-libs \ + libffi \ + openssl \ + jpeg \ + zlib \ + freetype \ + lcms2 \ + openjpeg \ + libusb \ + tiff \ + tk \ + tcl && \ + apk add --update --no-cache --virtual .builddeps \ + build-base \ + cython-dev \ + libxml2-dev \ + libxslt-dev \ + eudev-dev \ + libffi-dev \ + openssl-dev \ + jpeg-dev \ + zlib-dev \ + freetype-dev \ + lcms2-dev \ + openjpeg-dev \ + libusb-dev \ + tiff-dev \ + tk-dev \ + tcl-dev && \ + rm -rf /var/lib/apt/lists/* && \ + rm -rf /var/cache/apk/* && \ + pip install -Ur /build/requirements.txt && \ + pip install -Ue /build/[u2f] && \ + apk del .builddeps && \ + rm -rf .builddeps + ENTRYPOINT ["aws-google-auth"]