Dockerfile.template 2.99 KB
Newer Older
1
FROM index.docker.io/library/debian:buster-slim AS build
2
3
4
5
WORKDIR /
RUN apt-get -qq update && \
    apt-get -qq install wget unzip && \
    apt-get clean
6
RUN wget -q https://github.com/cantaloupe-project/cantaloupe/releases/download/v{{ version }}/cantaloupe-{{ version }}.zip -O temp.zip && \
7
    unzip temp.zip && \
8
    mv cantaloupe-{{ version }} cantaloupe && \
9
10
11
12
13
14
15
16
{%- if kakadu %}
    mkdir /kakadu && \
    mv cantaloupe/deps/Linux-x86-64/lib/* /kakadu && \
{% endif -%}
    rm -r cantaloupe/deps && \
    rm cantaloupe/cantaloupe.properties.sample
ADD ./cantaloupe.properties /cantaloupe/cantaloupe.properties

17
FROM index.docker.io/library/openjdk:16-slim-buster
18
# This variable assignment is mandatory to use the value in ENTRYPOINT
19
ENTRYPOINT ["/home/cantaloupe/run.sh", "{{ version }}"]
20
CMD ["-Dcantaloupe.config=/home/cantaloupe/app/cantaloupe.properties"]
21
HEALTHCHECK --start-period=30s CMD curl -sf 0.0.0.0:{{ port }} -o /dev/null || exit 1
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
RUN useradd cantaloupe && mkdir -p /home/cantaloupe/.cache/cantaloupe && chown -R cantaloupe: /home/cantaloupe/.cache
COPY --chown=cantaloupe --from=build /cantaloupe/ /home/cantaloupe/app/
ADD --chown=cantaloupe ./run.sh /home/cantaloupe/run.sh
ADD --chown=cantaloupe ./delegates.rb /home/cantaloupe/app/delegates.rb
{%- if kakadu %}
COPY --from=build /kakadu /usr/lib/
{% endif -%}
{%- if ffmpeg or turbojpeg or openjpeg or grok %}
RUN apt-get -qq update
{% endif -%}
{%- if ffmpeg %}
RUN apt-get -qq install --no-install-recommends ffmpeg
{% endif -%}
{%- if turbojpeg %}
RUN mkdir -p /opt/libjpeg-turbo/lib
COPY libs /opt/libjpeg-turbo/lib
{% endif -%}
{%- if openjpeg %}
RUN apt-get -qq install --no-install-recommends libopenjp2-tools
{% endif -%}
{%- if grok %}
RUN apt-get -qq install wget \
    liblcms2-dev \
    libpng-dev \
    libzstd-dev \
    libtiff-dev \
    libjpeg-dev \
    zlib1g-dev \
    libwebp-dev \
    libimage-exiftool-perl
RUN wget -q https://github.com/GrokImageCompression/grok/releases/download/v7.6.5/libgrokj2k1_7.6.5-1_amd64.deb \
    && wget -q https://github.com/GrokImageCompression/grok/releases/download/v7.6.5/grokj2k-tools_7.6.5-1_amd64.deb \
    && dpkg -i ./libgrokj2k1_7.6.5-1_amd64.deb \
    && dpkg -i --ignore-depends=libjpeg62-turbo ./grokj2k-tools_7.6.5-1_amd64.deb \
    # Install OpenJDK
    && wget -q https://github.com/AdoptOpenJDK/openjdk16-binaries/releases/download/jdk-16.0.1%2B9/OpenJDK16U-jdk_x64_linux_hotspot_16.0.1_9.tar.gz \
    && tar xfz OpenJDK16U-jdk_x64_linux_hotspot_16.0.1_9.tar.gz \
    && mv jdk-16.0.1+9 /opt/jdk \
    # Install Maven (the one in apt is too old for JDK16 as of 2020-05-14)
    && wget -q https://mirrors.ocf.berkeley.edu/apache/maven/maven-3/3.8.1/binaries/apache-maven-3.8.1-bin.tar.gz \
    && tar xfz apache-maven-3.8.1-bin.tar.gz \
    && mv apache-maven-3.8.1 /opt/maven \
    && rm apache-maven-3.8.1-bin.tar.gz
{% endif -%}
{%- if ffmpeg or turbojpeg or openjpeg or grok %}
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
{% endif -%}
USER cantaloupe
WORKDIR /home/cantaloupe
VOLUME ["/home/cantaloupe/images"]