-
Notifications
You must be signed in to change notification settings - Fork 29
/
Dockerfile
99 lines (88 loc) · 2.48 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
FROM heroku/heroku:22
# generic build tools
RUN apt-get update \
&& apt-get install -y \
build-essential \
wget \
python3-pip \
ninja-build \
pkg-config
RUN pip3 install meson
# use the heroku platform libraries when we can
#
# see https://devcenter.heroku.com/articles/stack-packages
#
# this should only pull in header files and should not create any extra run
# time dependencies
#
# heroku22 is missing highway, so we stick with orc for now
#
# we can't use pdfium since their binaries use a different C++ compiler from
# the one that libheif builds with
RUN apt-get install -y \
libarchive-dev \
glib-2.0-dev \
libexpat1-dev \
libpango1.0-dev \
librsvg2-dev \
libwebp-dev \
libjpeg-turbo8-dev \
libtiff5-dev \
libexif-dev \
liblcms2-dev \
liborc-0.4-dev \
libimagequant-dev \
libpoppler-glib-dev \
libcgif-dev \
libheif-dev \
libfftw3-dev
WORKDIR /usr/local/src
# build to this prefix
# - heroku has /usr/local/lib on the default ld.so.conf search path, so
# this is convenient
# - heroku has a basic dir structure in /usr/local, but no files
ARG PREFIX=/usr/local
ENV PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
# use libspng for PNG load and save
ARG SPNG_VERSION=0.7.4
ARG SPNG_URL=https://github.com/randy408/libspng/archive/refs/tags
RUN wget ${SPNG_URL}/v${SPNG_VERSION}.tar.gz \
&& tar xf v${SPNG_VERSION}.tar.gz \
&& cd libspng-${SPNG_VERSION} \
&& meson build --prefix=${PREFIX} --libdir=lib \
&& cd build \
&& ninja \
&& ninja install
ARG VIPS_VERSION=8.15.0
ARG VIPS_URL=https://github.com/libvips/libvips/releases/download
RUN wget ${VIPS_URL}/v${VIPS_VERSION}/vips-${VIPS_VERSION}.tar.xz \
&& tar xf vips-${VIPS_VERSION}.tar.xz \
&& cd vips-${VIPS_VERSION} \
&& meson setup build \
--prefix=$PREFIX \
--libdir=lib \
--buildtype=release \
-Dradiance=false \
-Danalyze=false \
-Dmodules=disabled \
-Dintrospection=disabled \
&& cd build \
&& meson compile \
&& meson install
# clean and package
RUN cd $PREFIX \
&& cp -r lib libvips-heroku22 \
&& cd libvips-heroku22 \
&& strip lib*.so* \
&& rm -rf pkgconfig \
&& rm -rf python* \
&& tar cfz ../libvips-heroku22.tar.gz * \
&& echo built libvips-heroku22.tar.gz \
&& ls -l $PREFIX/libvips-heroku22.tar.gz
# install and test ruby-vips to confirm we can pick up the libraries
# correctly
# we need ruby-dev to install ruby-ffi
ENV LD_LIBRAY_PATH=$PREFIX/lib
RUN apt-get install -y ruby-dev
RUN gem install ruby-vips
RUN ruby -e 'require "vips"; puts "ruby-vips: libvips #{Vips::LIBRARY_VERSION}"'