-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-kakadu-vips
111 lines (96 loc) · 3.12 KB
/
Dockerfile-kakadu-vips
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
100
101
102
103
104
105
106
107
108
109
110
111
FROM ubuntu:jammy
ARG KDU_VERSION=v8_3-02138L
ARG KAKADU_ARCH=Linux-arm-64-gcc
ARG RUBY=3.3.1
ARG VIPS_VERSION=8.15.2
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends \
# For VIPS
build-essential \
libnuma-dev \
meson \
ninja-build \
libjpeg-turbo8-dev \
libexif-dev \
librsvg2-dev \
libpoppler-glib-dev \
libarchive-dev \
libtiff-dev \
libfftw3-dev \
liblcms2-dev \
libpng-dev \
libimagequant-dev \
libmagickcore-dev \
libmagickwand-dev \
libpango1.0-dev \
libmatio-dev \
libcfitsio-dev \
libwebp-dev \
libopenslide-dev \
libheif-dev \
libcgif-dev \
liborc-0.4-dev \
curl \
# For Kakadu VIPS
libnuma-dev \
# For Ruby
autoconf \
patch \
rustc \
libssl-dev \
libyaml-dev \
libreadline6-dev \
zlib1g-dev \
libgmp-dev \
libncurses5-dev \
libffi-dev \
libgdbm6 \
libgdbm-dev \
libdb-dev \
uuid-dev \
ca-certificates
# Allow ImageMagick to write PDFs
RUN sed -i 's/<policy domain="coder" rights="none" pattern="PDF" \/>/<!-- <policy domain="coder" rights="none" pattern="PDF" \/> -->/' /etc/ImageMagick-6/policy.xml
# Install Ruby
SHELL ["/bin/bash", "-c"]
ADD https://github.com/rbenv/ruby-build/archive/refs/tags/v20240530.1.tar.gz /tmp/ruby-build.tar.gz
WORKDIR /tmp
RUN tar -xzf ruby-build.tar.gz
RUN PREFIX=/usr/local ./ruby-build-*/install.sh
RUN ruby-build ${RUBY} /opt/ruby
ENV PATH="/opt/ruby/bin:$PATH"
# Install VIPS
SHELL ["/bin/sh", "-c"]
ENV VIPSSRCHOME="/usr/local/src/vips"
RUN mkdir -p ${VIPSSRCHOME}
WORKDIR ${VIPSSRCHOME}
RUN curl -L https://github.com/libvips/libvips/releases/download/v${VIPS_VERSION}/vips-${VIPS_VERSION}.tar.xz --output vips-${VIPS_VERSION}.tar.xz
RUN tar -xf vips-${VIPS_VERSION}.tar.xz
ENV VIPSVERSIONHOME="${VIPSSRCHOME}/vips-${VIPS_VERSION}"
RUN cd ${VIPSVERSIONHOME} && meson setup build --buildtype=release -Dopenjpeg=disabled
WORKDIR ${VIPSVERSIONHOME}/build
RUN meson compile
RUN meson test
RUN meson install
ENV LD_LIBRARY_PATH="/usr/local/lib/aarch64-linux-gnu:${LD_LIBRARY_PATH}"
# Install Kakadu
ENV KAKADUVIPSSRCHOME="/usr/local/src/kakadu-vips"
COPY kakadu ${KAKADUVIPSSRCHOME}/kakadu/
ENV KAKADUHOME="${KAKADUVIPSSRCHOME}/kakadu/${KDU_VERSION}"
RUN cd ${KAKADUHOME}/make && make -f Makefile-${KAKADU_ARCH} clean
RUN cd ${KAKADUHOME}/coresys/make && make -f Makefile-${KAKADU_ARCH}
RUN cd ${KAKADUHOME}/managed/make && make -f Makefile-${KAKADU_ARCH} all_but_jni
RUN cd ${KAKADUHOME}/apps/make && make -f Makefile-${KAKADU_ARCH}
ENV PATH="${KAKADUHOME}/bin/${KAKADU_ARCH}:$PATH"
ENV LD_LIBRARY_PATH="${KAKADUHOME}/lib/${KAKADU_ARCH}:$LD_LIBRARY_PATH"
# Install Kakadu VIPS
COPY src ${KAKADUVIPSSRCHOME}/src/
COPY test/images/church.jp2 ${KAKADUVIPSSRCHOME}/church.jp2
RUN cd ${KAKADUVIPSSRCHOME}/src && make && make install
RUN useradd -m -s /bin/bash ruby
RUN chown -R ruby:ruby /opt/ruby
USER ruby
WORKDIR ${KAKADUVIPSSRCHOME}
# Build with: docker build . -t sul-dlss/kakadu-vips:latest
# Build and run: docker run --rm -it $(docker build -q .)
# Test with: vips kakaduload church.jp2 x.jpg