-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
98 lines (73 loc) · 3.22 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
ARG CANTALOUPE_VERSION=5.0.6
# Build
FROM ubuntu:noble@sha256:80dd3c3b9c6cecb9f1667e9290b3bc61b78c2678c02cbdae5f0fea92cc6734ab AS build
ARG DEBIAN_FRONTEND=noninteractive
ARG CANTALOUPE_VERSION
# Install various dependencies:
# * ca-certificates is needed by wget
# * ffmpeg is needed by FfmpegProcessor
# * wget download stuffs in this dockerfile
# * libopenjp2-tools is needed by OpenJpegProcessor
# * All the rest is needed by GrokProcessor
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
openjdk-11-jdk-headless \
ffmpeg \
maven \
wget \
libopenjp2-tools \
liblcms2-dev \
libpng-dev \
libzstd-dev \
libtiff-dev \
libjpeg-dev \
zlib1g-dev \
libwebp-dev \
libimage-exiftool-perl \
libgrokj2k1 \
grokj2k-tools \
curl \
unzip \
patch
# Grab source code and patch
RUN curl --silent --fail -OL https://github.com/cantaloupe-project/cantaloupe/archive/refs/tags/v$CANTALOUPE_VERSION.zip
RUN unzip v$CANTALOUPE_VERSION.zip
RUN mv cantaloupe-$CANTALOUPE_VERSION cantaloupe-src
# Install TurboJpegProcessor dependencies
RUN mkdir -p /opt/libjpeg-turbo/lib
RUN cp -r cantaloupe-src/docker/Linux-JDK11/image_files/libjpeg-turbo/lib64 /opt/libjpeg-turbo/lib
# Install KakaduNativeProcessor dependencies
RUN cp cantaloupe-src/dist/deps/Linux-x86-64/lib/* /usr/lib/
# Install various other dependencies that aren't in apt
# Add our patches to the source
COPY ./patches ./
RUN cd cantaloupe-src/ && patch -p1 < /add-WebIdentityTokenFileCredentialsProvider-to-credentials-chain.patch
# Install application dependencies
RUN cd cantaloupe-src/ && mvn --quiet dependency:resolve
# Build
RUN cd cantaloupe-src/ && mvn clean package -DskipTests
# Package
FROM ubuntu:noble@sha256:80dd3c3b9c6cecb9f1667e9290b3bc61b78c2678c02cbdae5f0fea92cc6734ab AS image
LABEL org.opencontainers.image.source="https://github.com/elifesciences/enhanced-preprints-image-server"
ARG CANTALOUPE_VERSION
ENV CANTALOUPE_VERSION=$CANTALOUPE_VERSION
EXPOSE 8182
# Update packages and install tools
RUN apt-get update -qy && apt-get dist-upgrade -qy && \
apt-get install -qy --no-install-recommends curl imagemagick \
libopenjp2-tools ffmpeg unzip default-jre-headless adduser && \
apt-get -qqy autoremove && apt-get -qqy autoclean
# Run non privileged
RUN adduser --system cantaloupe
# Get and unpack Cantaloupe release archive
COPY --from=build /cantaloupe-src/target/cantaloupe-$CANTALOUPE_VERSION.zip ./opt
RUN cd /opt \
&& unzip cantaloupe-$CANTALOUPE_VERSION.zip \
&& ln -s cantaloupe-$CANTALOUPE_VERSION cantaloupe \
&& rm cantaloupe-$CANTALOUPE_VERSION.zip \
&& mkdir -p /var/log/cantaloupe /var/cache/cantaloupe \
&& cp -rs /opt/cantaloupe/deps/Linux-x86-64/* /usr/
COPY cantaloupe.properties /opt/cantaloupe/
RUN chown -R cantaloupe /opt/cantaloupe-$CANTALOUPE_VERSION /var/log/cantaloupe /var/cache/cantaloupe
USER cantaloupe
CMD ["sh", "-c", "java -Dcantaloupe.config=/opt/cantaloupe/cantaloupe.properties -Dsoftware.amazon.awssdk.http.service.impl=software.amazon.awssdk.http.urlconnection.UrlConnectionSdkHttpService -jar /opt/cantaloupe/cantaloupe-$CANTALOUPE_VERSION.jar"]