-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
32 lines (29 loc) · 1.3 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
FROM python:3.10-bullseye
ENV PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=off
# Make sure optimized libjpeg is used for smaller thumbnail images
# Based on https://engineeringblog.yelp.com/2017/06/making-photos-smaller.html
# and https://github.com/danbooru/danbooru/blob/master/Dockerfile
ARG MOZJPEG_VERSION=4.1.5
RUN apt-get update \
&& apt-get install --yes cmake nasm libpng-dev zlib1g-dev libwebp-dev \
&& rm /usr/lib/x86_64-linux-gnu/pkgconfig/xcb.pc \
/usr/lib/x86_64-linux-gnu/libxcb.* \
/usr/lib/x86_64-linux-gnu/pkgconfig/libjpeg.pc \
/usr/lib/x86_64-linux-gnu/libjpeg.* \
/usr/include/xcb/*.h \
/usr/include/jpegint.h \
&& mkdir /root/build \
&& curl -L -s https://github.com/mozilla/mozjpeg/archive/v$MOZJPEG_VERSION.tar.gz \
| tar --directory=/root/build -zxf - \
&& cd /root/build/mozjpeg-$MOZJPEG_VERSION \
&& cmake -DCMAKE_INSTALL_PREFIX=/opt/mozjpeg -DENABLE_STATIC=0 -DWITH_ARITH_ENC=1 -DWITH_ARITH_DEC=1 . \
&& make -j install/strip \
&& rm -rf * /opt/mozjpeg/share /opt/mozjpeg/man \
&& /opt/mozjpeg/bin/cjpeg -version
ENV LIBDIR=/opt/mozjpeg/lib64 \
LD_RUN_PATH=/opt/mozjpeg/lib64:/usr/lib/x86_64-linux-gnu
# Add caching layer for latest pillow
RUN pip install -U pip wheel \
&& pip install --no-binary=Pillow -C xcb=disable Pillow \
&& pip install uwsgi