parent
764f85fb40
commit
ec7fa6332d
5 changed files with 56 additions and 5 deletions
29
Dockerfile
29
Dockerfile
|
@ -7,14 +7,39 @@ RUN npm run build
|
|||
|
||||
FROM python:3.9-alpine
|
||||
|
||||
RUN apk add --no-cache libxml2-dev libxslt-dev libxml2 caddy libffi-dev
|
||||
|
||||
RUN apk add --no-cache libxml2-dev \
|
||||
libxslt-dev \
|
||||
libxml2 caddy \
|
||||
libffi-dev \
|
||||
python3 \
|
||||
python3-dev \
|
||||
openssl \
|
||||
bash \
|
||||
sudo \
|
||||
# freetype-dev \
|
||||
# fribidi-dev \
|
||||
# harfbuzz-dev \
|
||||
jpeg-dev \
|
||||
lcms2-dev \
|
||||
openjpeg-dev \
|
||||
# tcl-dev \
|
||||
# tiff-dev \
|
||||
# tk-dev \
|
||||
zlib-dev
|
||||
|
||||
ADD depends /depends
|
||||
RUN cd /depends \
|
||||
&& chmod +x install_webp.sh \
|
||||
&& chmod +x download-and-extract.sh \
|
||||
&& ./install_webp.sh
|
||||
|
||||
ENV ENV True
|
||||
EXPOSE 80
|
||||
WORKDIR /app/
|
||||
|
||||
COPY ./pyproject.toml /app/
|
||||
|
||||
|
||||
RUN apk add --update --no-cache --virtual .build-deps \
|
||||
curl \
|
||||
g++ \
|
||||
|
|
12
depends/download-and-extract.sh
Normal file
12
depends/download-and-extract.sh
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
# Usage: ./download-and-extract.sh something https://example.com/something.tar.gz
|
||||
|
||||
archive=$1
|
||||
url=$2
|
||||
|
||||
if [ ! -f $archive.tar.gz ]; then
|
||||
wget -O $archive.tar.gz $url
|
||||
fi
|
||||
|
||||
rm -r $archive
|
||||
tar -xvzf $archive.tar.gz
|
12
depends/install_webp.sh
Normal file
12
depends/install_webp.sh
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
# install webp
|
||||
|
||||
archive=libwebp-1.2.0
|
||||
|
||||
./download-and-extract.sh $archive https://raw.githubusercontent.com/python-pillow/pillow-depends/master/$archive.tar.gz
|
||||
|
||||
pushd $archive
|
||||
|
||||
./configure --prefix=/usr --enable-libwebpmux --enable-libwebpdemux && make -j4 && sudo make -j4 install
|
||||
|
||||
popd
|
File diff suppressed because one or more lines are too long
|
@ -1,3 +1,4 @@
|
|||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
from mealie.core.config import app_dirs
|
||||
|
@ -23,8 +24,9 @@ def minify_image(image_file: Path, min_dest: Path, tiny_dest: Path):
|
|||
tiny_image = crop_center(img)
|
||||
tiny_image.save(tiny_dest, quality=70)
|
||||
|
||||
except UnidentifiedImageError:
|
||||
pass
|
||||
except:
|
||||
shutil.copy(image_file, min_dest)
|
||||
shutil.copy(image_file, tiny_dest)
|
||||
|
||||
|
||||
def crop_center(pil_img, crop_width=300, crop_height=300):
|
||||
|
|
Loading…
Reference in a new issue