From 584eb30f98e862f77e8802c9d9dedb7352cf9a16 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Sat, 5 Jun 2021 21:48:24 +0530 Subject: trying alpine --- Dockerfile | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7c527f5..6d7248d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.8-slim AS builder +FROM python:3.8-alpine AS builder LABEL maintainer = "Navan Chauhan " \ org.label-schema.name="SaaS-in-a-Flask" \ @@ -9,12 +9,31 @@ EXPOSE 5000 WORKDIR /saas-in-a-flask COPY simple-requirements.txt api.py ./ -RUN apt-get update \ - && apt-get install -y --no-install-recommends gcc libssl-dev libffi-dev python3-dev build-essential \ - && rm -rf /var/lib/apt/lists/* \ - && pip install --upgrade pip \ - && pip install -r simple-requirements.txt \ - && apt-get purge -y --auto-remove gcc libssl-dev libffi-dev python3-dev build-essential +RUN apk add --no-cache --virtual .build-deps \ + build-base \ + cairo \ + cairo-dev \ + cargo \ + gcc \ + libffi-dev \ + openssl-dev \ + py-cffi \ + python3-dev \ + rust \ + && pip install -r requirements.txt \ + && find /usr/local \ + \( -type d -a -name test -o -name tests \) \ + -o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ + -exec rm -rf '{}' + \ + && runDeps="$( \ + scanelf --needed --nobanner --recursive /usr/local \ + | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ + | sort -u \ + | xargs -r apk info --installed \ + | sort -u \ + )" \ + && apk add --virtual .rundeps $runDeps \ + && apk del .build-deps COPY ./app ./app -- cgit v1.2.3