-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
93 lines (76 loc) · 3.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
FROM ubuntu:jammy as build
ENV CANTALOUPE_VERSION=5.0.6
ENV OPENJPEG_VERSION=2.5.2
ENV GROK_VERSION=12.0.3
ARG DEBIAN_FRONTEND=noninteractive
# Install various dependencies:
# * ca-certificates is needed by wget
# * wget download stuffs in this dockerfile
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
wget \
unzip
RUN wget -q https://github.com/cantaloupe-project/cantaloupe/releases/download/v$CANTALOUPE_VERSION/cantaloupe-$CANTALOUPE_VERSION.zip \
&& unzip cantaloupe-$CANTALOUPE_VERSION.zip \
&& wget -q https://github.com/uclouvain/openjpeg/releases/download/v$OPENJPEG_VERSION/openjpeg-v$OPENJPEG_VERSION-linux-x86_64.tar.gz \
&& tar -xzf openjpeg-v$OPENJPEG_VERSION-linux-x86_64.tar.gz \
&& wget -q https://github.com/GrokImageCompression/grok/releases/download/v$GROK_VERSION/grok-ubuntu-latest.zip \
&& unzip grok-ubuntu-latest.zip
FROM ubuntu:jammy
ENV CANTALOUPE_VERSION=5.0.6
ENV OPENJPEG_VERSION=2.5.2
ENV JAVA_HOME=/opt/jdk
ENV PATH=$PATH:/opt/jdk/bin:/opt/maven/bin
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib
ENV MAXHEAP=2g
ENV INITHEAP=256m
ARG DEBIAN_FRONTEND=noninteractive
LABEL maintainer="Donald Gray <[email protected]>"
LABEL org.opencontainers.image.source=https://github.com/dlcs/image-server-node-cantaloupe
LABEL org.opencontainers.image.description="Cantaloupe image-server on Ubuntu"
# Install various dependencies:
# * ffmpeg is needed by FfmpegProcessor
# * libopenjp2-tools is needed by OpenJpegProcessor
# * All the rest is needed by GrokProcessor
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \
libopenjp2-tools \
liblcms2-dev \
libpng-dev \
libzstd-dev \
libtiff-dev \
libjpeg-dev \
zlib1g-dev \
libwebp-dev \
libimage-exiftool-perl \
default-jre-headless \
awscli \
&& rm -rf /var/lib/apt/lists/*
# Copy GrokProcessor
COPY --from=build /grok-ubuntu-latest/bin/* /bin
COPY --from=build /grok-ubuntu-latest/lib/* /lib
COPY --from=build /grok-ubuntu-latest/include/grok-12.0/* /usr/lib
# Copy OpenJPEG
COPY --from=build /openjpeg-v$OPENJPEG_VERSION-linux-x86_64/bin/* /bin
COPY --from=build /openjpeg-v$OPENJPEG_VERSION-linux-x86_64/lib/* /lib
COPY --from=build /openjpeg-v$OPENJPEG_VERSION-linux-x86_64/include/openjpeg-2.5/* /usr/lib/
# Copy TurboJpegProcessor dependencies + create symlinks
COPY libjpeg /opt/libjpeg-turbo/lib
RUN ln -s /opt/libjpeg-turbo/lib/libjpeg.so.62.3.0 /opt/libjpeg-turbo/lib/libjpeg.so.62
RUN ln -s /opt/libjpeg-turbo/lib/libjpeg.so.62 /opt/libjpeg-turbo/lib/libjpeg.so
RUN ln -s /opt/libjpeg-turbo/lib/libturbojpeg.so.0.2.0 /opt/libjpeg-turbo/lib/libturbojpeg.so.0
RUN ln -s /opt/libjpeg-turbo/lib/libturbojpeg.so.0 /opt/libjpeg-turbo/lib/libturbojpeg.so
# Add non-root user
RUN adduser --system cantaloupeusr
# Setup Cantaloupe
COPY --from=build /cantaloupe-$CANTALOUPE_VERSION/cantaloupe-$CANTALOUPE_VERSION.jar /cantaloupe/cantaloupe-$CANTALOUPE_VERSION.jar
RUN mkdir -p /var/log/cantaloupe /var/cache/cantaloupe \
&& chown -R cantaloupeusr /cantaloupe /var/log/cantaloupe /var/cache/cantaloupe
# Copy sample properties file + delegates
COPY cantaloupe.properties.sample /cantaloupe/cantaloupe.properties.sample
COPY delegates.rb /cantaloupe/delegates.rb
COPY entrypoint/* /opt/app/
RUN chmod +x --recursive /opt/app/
EXPOSE 8182
USER cantaloupeusr
CMD ["sh", "-c", "java -Dcantaloupe.config=/cantaloupe/cantaloupe.properties.sample -Xmx$MAXHEAP -Xms$INITHEAP -jar /cantaloupe/cantaloupe-$CANTALOUPE_VERSION.jar"]