From 1bb272e07f77cc6ef56eb9f8b34a0fa7cdb38504 Mon Sep 17 00:00:00 2001 From: Ajurna Date: Wed, 5 May 2021 20:07:02 +0100 Subject: [PATCH] Docker compress (#31) * update to Dockerfile to make the build much smaller. * update to Dockerfile to make the build much smaller. * update to Dockerfile to make the build much smaller. * update to Dockerfile to make the build much smaller. * update to Dockerfile to make the build much smaller. * update to Dockerfile to make the build much smaller. * update to Dockerfile to make the build much smaller. * update to Dockerfile to make the build much smaller. * update to Dockerfile to make the build much smaller. * update to Dockerfile to make the build much smaller. * update to Dockerfile to make the build much smaller. * update to Dockerfile to make the build much smaller. * update to Dockerfile to make the build much smaller. * update to Dockerfile to make the build much smaller. * update to Dockerfile to make the build much smaller. * update to Dockerfile to make the build much smaller. * update to Dockerfile to make the build much smaller. * update to Dockerfile to make the build much smaller. * update to Dockerfile to make the build much smaller. * update to Dockerfile to make the build much smaller. * update to Dockerfile to make the build much smaller. * update to Dockerfile to make the build much smaller. * update to Dockerfile to make the build much smaller. * update to Dockerfile to make the build much smaller. * update to Dockerfile to make the build much smaller. --- Dockerfile | 29 ++++++++++------------------- comic/models.py | 2 +- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/Dockerfile b/Dockerfile index d247509..dbe5630 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,31 +15,24 @@ ENV PIP_DEFAULT_TIMEOUT=100 \ PIP_NO_CACHE_DIR=1 RUN apk update -RUN apk add --no-cache tini bash unrar dcron postgresql-dev gcc python3-dev musl-dev libffi-dev jpeg-dev -RUN apk add --no-cache --virtual .build-deps mariadb-dev build-base \ - && apk add --virtual .runtime-deps mariadb-connector-c-dev mariadb-connector-c - -RUN apk add gcc g++ cmake make mupdf-dev freetype-dev ARG MUPDF=1.18.0 -RUN ln -s /usr/include/freetype2/ft2build.h /usr/include/ft2build.h \ + +COPY requirements.txt /src + +RUN apk add --no-cache --virtual .build-deps gcc build-base g++ cmake make postgresql-dev mariadb-dev mariadb-connector-c-dev musl-dev mupdf-dev python3-dev freetype-dev libffi-dev \ + && apk add --no-cache tini bash unrar dcron python3 mariadb-connector-c jpeg-dev postgresql-libs \ + && ln -s /usr/include/freetype2/ft2build.h /usr/include/ft2build.h \ && ln -s /usr/include/freetype2/freetype/ /usr/include/freetype \ && wget -c -q https://www.mupdf.com/downloads/archive/mupdf-${MUPDF}-source.tar.gz \ && tar xf mupdf-${MUPDF}-source.tar.gz \ && cd mupdf-${MUPDF}-source \ && make HAVE_X11=no HAVE_GLUT=no shared=yes prefix=/usr/local install \ && cd .. \ - && rm -rf *.tar.gz mupdf-${MUPDF}-source - -RUN pip install --upgrade pip - -RUN pip install PyMuPDF==1.18.12 - -COPY requirements.txt /src - -RUN pip install -r requirements.txt - -RUN apk del .build-deps + && rm -rf *.tar.gz mupdf-${MUPDF}-source \ + && pip install --upgrade pip \ + && pip install -r requirements.txt \ + && apk del .build-deps ADD https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh /src @@ -50,5 +43,3 @@ COPY . /src/ RUN cat /src/cbreader/crontab >> /etc/crontabs/root EXPOSE 8000 - - diff --git a/comic/models.py b/comic/models.py index ec86c5c..f8da574 100644 --- a/comic/models.py +++ b/comic/models.py @@ -351,7 +351,7 @@ class ComicBook(models.Model): book.verify_pages() elif archive_type == 'pdf': with atomic(): - for page_index in range(archive.getNumPages()): + for page_index in range(archive.page_count): page = ComicPage( Comic=book, index=page_index, page_file_name=page_index+1, content_type='application/pdf' )