Slimming down dale-bot by adding --no-install-recommends, cuts 200MB off the image size

This commit is contained in:
Luke Robles 2022-03-17 11:24:13 -07:00
parent 616c745855
commit 74da2235a9
3 changed files with 8 additions and 5 deletions

View File

@ -1,9 +1,12 @@
FROM python:3.8 as build FROM python:3.8 as build
ADD app/requirements.txt /requirements.txt ADD app/requirements.txt /requirements.txt
RUN apt-get update && apt-get install -y libmagickwand-dev && pip install --no-cache-dir -q -r requirements.txt RUN apt-get update && apt-get install -y --no-install-recommends libmagickwand-dev && pip install --no-cache-dir -q -r requirements.txt
FROM python:3.8-slim FROM python:3.8-slim
RUN apt-get update && apt-get install -y libmagickwand-dev RUN apt-get update && apt-get install -y --no-install-recommends libmagickwand-dev \
&& apt-get autoremove -y \
&& apt-get purge -y --auto-remove \
&& rm -rf /var/lib/apt/lists/* /root
COPY --from=0 /usr/local/lib/python3.8/site-packages /usr/local/lib/python3.8/site-packages COPY --from=0 /usr/local/lib/python3.8/site-packages /usr/local/lib/python3.8/site-packages
ADD app /app ADD app /app
CMD python /app/bot.py CMD python /app/bot.py

View File

@ -1,9 +1,9 @@
FROM python:3.8 as build FROM python:3.8 as build
ADD app/requirements.txt /requirements.txt ADD app/requirements.txt /requirements.txt
RUN apt-get update && apt-get install -y libmagickwand-dev && pip install --no-cache-dir -q -r requirements.txt RUN apt-get update && apt-get install -y --no-install-recommends libmagickwand-dev && pip install --no-cache-dir -q -r requirements.txt
FROM python:3.8-slim FROM python:3.8-slim
RUN apt-get update && apt-get install -y libmagickwand-dev RUN apt-get update && apt-get install -y --no-install-recommends libmagickwand-dev
COPY --from=0 /usr/local/lib/python3.8/site-packages /usr/local/lib/python3.8/site-packages COPY --from=0 /usr/local/lib/python3.8/site-packages /usr/local/lib/python3.8/site-packages
ADD app /app ADD app /app
WORKDIR /app WORKDIR /app

View File

@ -8,7 +8,7 @@ image:
repository: ldooks/dragon-bot repository: ldooks/dragon-bot
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion. # Overrides the image tag whose default is the chart appVersion.
tag: "130" tag: "131"
imagePullSecrets: [] imagePullSecrets: []
nameOverride: "" nameOverride: ""