Verified Commit 044c9c37 authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files

include specific processors during build

parent 0593329d
Pipeline #8628 passed with stage
in 11 minutes and 22 seconds
include:
- project: 'memoriav/memobase-2020/utilities/ci-templates'
file: 'docker-image.yml'
variables:
DOCKER_TLS_CERTDIR: ""
stages:
- publish
.build-image:
stage: publish
image: docker:stable
services:
- docker:dind
script:
- docker login -u "$REGISTRY_USER" -p "$REGISTRY_PASSWORD" "$REGISTRY"
- docker build --pull -t "$IMAGE_TAG" -f "$DOCKERFILE" --build-arg BUILD_WITH="$BUILD_WITH" .
- docker push "$IMAGE_TAG"
- docker logout
build-latest-vanilla:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:latest-vanilla"
REGISTRY_PASSWORD: "$CI_REGISTRY_PASSWORD"
REGISTRY_USER: "$CI_REGISTRY_USER"
REGISTRY: "$CI_REGISTRY"
DOCKERFILE: "Dockerfile"
BUILD_WITH: ""
only:
- master
build-latest-jp2:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:latest-jp2"
REGISTRY_PASSWORD: "$CI_REGISTRY_PASSWORD"
REGISTRY_USER: "$CI_REGISTRY_USER"
REGISTRY: "$CI_REGISTRY"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "kakadu"
only:
- master
build-latest-jp2-free:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:latest-jp2-free"
REGISTRY_PASSWORD: "$CI_REGISTRY_PASSWORD"
REGISTRY_USER: "$CI_REGISTRY_USER"
REGISTRY: "$CI_REGISTRY"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "openjpg"
only:
- master
build-latest-video:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:latest-video"
REGISTRY_PASSWORD: "$CI_REGISTRY_PASSWORD"
REGISTRY_USER: "$CI_REGISTRY_USER"
REGISTRY: "$CI_REGISTRY"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "ffmpeg"
only:
- master
build-latest-images:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:latest-images"
REGISTRY_PASSWORD: "$CI_REGISTRY_PASSWORD"
REGISTRY_USER: "$CI_REGISTRY_USER"
REGISTRY: "$CI_REGISTRY"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "graphicsmagick"
only:
- master
build-latest-images-jp2:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:latest-images-jp2"
REGISTRY_PASSWORD: "$CI_REGISTRY_PASSWORD"
REGISTRY_USER: "$CI_REGISTRY_USER"
REGISTRY: "$CI_REGISTRY"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "graphicsmagick kakadu"
only:
- master
build-latest-images-jp2-free:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:latest-images-jp2-free"
REGISTRY_PASSWORD: "$CI_REGISTRY_PASSWORD"
REGISTRY_USER: "$CI_REGISTRY_USER"
REGISTRY: "$CI_REGISTRY"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "graphicsmagick openjpeg"
only:
- master
build-latest-all:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:latest-all"
REGISTRY_PASSWORD: "$CI_REGISTRY_PASSWORD"
REGISTRY_USER: "$CI_REGISTRY_USER"
REGISTRY: "$CI_REGISTRY"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "kakadu graphicsmagick ffmpeg"
only:
- master
build-latest-all-free:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:latest-all-free"
REGISTRY_PASSWORD: "$CI_REGISTRY_PASSWORD"
REGISTRY_USER: "$CI_REGISTRY_USER"
REGISTRY: "$CI_REGISTRY"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "openjpeg graphicsmagick ffmpeg"
only:
- master
build-version-vanilla:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME-vanilla"
REGISTRY_PASSWORD: "$CI_REGISTRY_PASSWORD"
REGISTRY_USER: "$CI_REGISTRY_USER"
REGISTRY: "$CI_REGISTRY"
DOCKERFILE: "Dockerfile"
BUILD_WITH: ""
except:
- master
- tags
build-version-jp2:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME-jp2"
REGISTRY_PASSWORD: "$CI_REGISTRY_PASSWORD"
REGISTRY_USER: "$CI_REGISTRY_USER"
REGISTRY: "$CI_REGISTRY"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "kakadu"
except:
- master
- tags
build-version-jp2-free:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME-jp2-free"
REGISTRY_PASSWORD: "$CI_REGISTRY_PASSWORD"
REGISTRY_USER: "$CI_REGISTRY_USER"
REGISTRY: "$CI_REGISTRY"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "openjpg"
except:
- master
- tags
build-version-video:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME-video"
REGISTRY_PASSWORD: "$CI_REGISTRY_PASSWORD"
REGISTRY_USER: "$CI_REGISTRY_USER"
REGISTRY: "$CI_REGISTRY"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "ffmpeg"
except:
- master
- tags
build-version-images:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME-images"
REGISTRY_PASSWORD: "$CI_REGISTRY_PASSWORD"
REGISTRY_USER: "$CI_REGISTRY_USER"
REGISTRY: "$CI_REGISTRY"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "graphicsmagick"
except:
- master
- tags
build-version-images-jp2:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME-images-jp2"
REGISTRY_PASSWORD: "$CI_REGISTRY_PASSWORD"
REGISTRY_USER: "$CI_REGISTRY_USER"
REGISTRY: "$CI_REGISTRY"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "graphicsmagick kakadu"
except:
- master
- tags
build-version-images-jp2-free:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME-images-jp2-free"
REGISTRY_PASSWORD: "$CI_REGISTRY_PASSWORD"
REGISTRY_USER: "$CI_REGISTRY_USER"
REGISTRY: "$CI_REGISTRY"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "graphicsmagick openjpeg"
except:
- master
- tags
build-version-all:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME-all"
REGISTRY_PASSWORD: "$CI_REGISTRY_PASSWORD"
REGISTRY_USER: "$CI_REGISTRY_USER"
REGISTRY: "$CI_REGISTRY"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "kakadu graphicsmagick ffmpeg"
except:
- master
- tags
build-version-all-free:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME-all-free"
REGISTRY_PASSWORD: "$CI_REGISTRY_PASSWORD"
REGISTRY_USER: "$CI_REGISTRY_USER"
REGISTRY: "$CI_REGISTRY"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "openjpeg graphicsmagick ffmpeg"
except:
- master
- tags
FROM debian:buster-slim AS build
ARG VERSION=4.1.5
ARG BUILD_WITH=""
WORKDIR /
RUN apt-get -qq update && \
apt-get -qq install wget unzip && \
......@@ -7,7 +8,8 @@ RUN apt-get -qq update && \
RUN wget -q https://github.com/cantaloupe-project/cantaloupe/releases/download/v${VERSION}/cantaloupe-${VERSION}.zip -O temp.zip && \
unzip temp.zip && \
mv cantaloupe-${VERSION} cantaloupe && \
mv cantaloupe/deps/Linux-x86-64/lib /tmp/lib && \
mkdir /kakadu && \
if [ "$BUILD_WITH" != "${BUILD_WITH%"kakadu"*}" ]; then mv cantaloupe/deps/Linux-x86-64/lib/* /kakadu; fi && \
rm -r cantaloupe/deps && \
rm cantaloupe/cantaloupe.properties.sample
ADD ./cantaloupe.properties /cantaloupe/cantaloupe.properties
......@@ -16,13 +18,18 @@ FROM openjdk:11-jre-slim
ENTRYPOINT ["/home/cantaloupe/run.sh", "4.1.5"]
CMD ["-Dcantaloupe.config=/home/cantaloupe/app/cantaloupe.properties", "-Xmx2g"]
ARG HTTP_PORT=8182
ARG BUILD_WITH=""
HEALTHCHECK --start-period=30s CMD curl -sf 0.0.0.0:${HTTP_PORT} -o /dev/null || exit 1
RUN useradd cantaloupe && mkdir -p /home/cantaloupe/.cache/cantaloupe && chown -R cantaloupe: /home/cantaloupe/.cache
COPY --chown=cantaloupe --from=build /cantaloupe/ /home/cantaloupe/app/
COPY --from=build /tmp/lib/* /usr/lib/
COPY --from=build /kakadu /usr/lib/
ADD --chown=cantaloupe ./run.sh /home/cantaloupe/run.sh
RUN apt-get -qq update && \
apt-get -qq install curl fontconfig libfreetype6 && \
if [ "$BUILD_WITH" != "${BUILD_WITH%"ffmpeg"*}" ]; then apt-get -qq install --no-install-recommends ffmpeg; fi && \
if [ "$BUILD_WITH" != "${BUILD_WITH%"graphicsmagick"*}" ]; then apt-get -qq install --no-install-recommends graphicsmagick; fi && \
if [ "$BUILD_WITH" != "${BUILD_WITH%"imagemagick"*}" ]; then apt-get -qq install --no-install-recommends imagemagick; fi && \
if [ "$BUILD_WITH" != "${BUILD_WITH%"openjpeg"*}" ]; then apt-get -qq install libopenjp2-tools; fi && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
USER cantaloupe
......
......@@ -39,6 +39,26 @@ uppercase letters, `.` being replaced by `_` (e.g. `https.key_store_path` ->
docker run --name cantaloupe --rm -d -p8182:8182 -v<path_to_host_image_folder>:/home/cantaloupe/images cantaloupe:<tag>
```
### Processor support
Cantaloupe supports different backends for processing media resources.
To keep the image small, none of these processors is enabled in the image per
default. However you can build the image with the required processor backends
by providing one or several keys in the build arg `BUILD_WITH` (example
see below):
- [`ffmpeg`](https://ffmpeg.org/): Used for video processing
- [`graphicsmagick`](http://www.graphicsmagick.org/): Used for general
image processing
- [`imagemagick`](https://www.imagemagick.org/): More or less like GraphicsMagick
- [`kakadu`](https://kakadusoftware.com/): Fast processor for JPEG2000,
proprietary
- [`openjpeg`](http://www.openjpeg.org/): Like kakadu, but open source software
```sh
docker run --name cantaloupe --rm -d -p8182:8182 -v<path_to_host_image_folder>:/home/cantaloupe/images -e BUILD_WITH="ffmpeg imagemagick" cantaloupe:<tag>
```
### With Redis
Cantaloupe supports [Redis](https://redis.io) as an external key-value store for caching.
......@@ -52,6 +72,7 @@ docker run -d --name redis \
docker run -d --name cantaloupe \
--rm -p 8182:8182 \
--network cantaloupe \
-eCACHE_SERVER_DERIVATIVE_ENABLED=true \
-eCACHE_SERVER_DERIVATIVE=RedisCache \
-eREDISCACHE_HOST=redis \
-v<path_to_host_image_folder>:/home/cantaloupe/images \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment