Rework docker setup

This commit is contained in:
eikek
2021-05-31 00:07:11 +02:00
parent c0402b1f92
commit b122d9eab0
8 changed files with 326 additions and 0 deletions

34
docker/dockerfiles/build.sh Executable file
View File

@ -0,0 +1,34 @@
#!/usr/bin/env bash
if [ -z "$1" ]; then
echo "Please specify a version"
exit 1
fi
version="$1"
if [[ $version == v* ]]; then
version="${version:1}"
fi
cd "$(dirname "$0")"
echo "============ Building Tools ============"
docker build \
--build-arg version=$version \
--tag docspell/tools:v$version \
--tag docspell/tools:latest \
-f tools.dockerfile .
echo "============ Building Restserver ============"
docker build \
--build-arg version=$version \
--tag docspell/restserver:v$version \
--tag docspell/restserver:latest \
-f restserver.dockerfile .
echo "============ Building Joex ============"
docker build \
--build-arg version=$version \
--tag docspell/joex:v$version \
--tag docspell/joex:latest \
-f joex.dockerfile .

View File

@ -0,0 +1,6 @@
#!/bin/sh
echo "Starting unoconv listener"
unoconv -l &
/opt/docspell-joex/bin/docspell-joex "$@"

View File

@ -0,0 +1,68 @@
FROM alpine:latest
ARG version=
ARG joex_url=
ARG UNO_URL=https://raw.githubusercontent.com/unoconv/unoconv/0.9.0/unoconv
ENV JAVA_OPTS="-Xmx1536M"
RUN apk add --no-cache openjdk11 \
tzdata \
bash \
curl \
ghostscript \
tesseract-ocr \
tesseract-ocr-data-deu \
tesseract-ocr-data-fra \
tesseract-ocr-data-ita \
tesseract-ocr-data-spa \
tesseract-ocr-data-por \
tesseract-ocr-data-ces \
tesseract-ocr-data-nld \
tesseract-ocr-data-dan \
tesseract-ocr-data-fin \
tesseract-ocr-data-nor \
tesseract-ocr-data-swe \
tesseract-ocr-data-rus \
tesseract-ocr-data-ron \
tesseract-ocr-data-lav \
unpaper \
wkhtmltopdf \
libreoffice \
ttf-droid-nonlatin \
ttf-droid \
ttf-dejavu \
ttf-freefont \
ttf-liberation \
libxml2-dev \
libxslt-dev \
pngquant \
zlib-dev \
g++ \
qpdf \
py3-pip \
python3-dev \
libffi-dev\
qpdf-dev \
openssl-dev \
ocrmypdf \
&& pip3 install --upgrade pip \
&& pip3 install ocrmypdf \
&& curl -Ls $UNO_URL -o /usr/local/bin/unoconv \
&& chmod +x /usr/local/bin/unoconv \
&& apk del curl libxml2-dev libxslt-dev zlib-dev g++ python3-dev py3-pip libffi-dev qpdf-dev openssl-dev \
&& ln -s /usr/bin/python3 /usr/bin/python
WORKDIR /opt
RUN wget ${joex_url:-https://github.com/eikek/docspell/releases/download/v$version/docspell-joex-$version.zip} && \
unzip docspell-joex-*.zip && \
rm docspell-joex-*.zip && \
ln -snf docspell-joex-* docspell-joex
COPY joex-entrypoint.sh /opt/joex-entrypoint.sh
ENTRYPOINT ["/opt/joex-entrypoint.sh"]
EXPOSE 7878
HEALTHCHECK --interval=1m --timeout=10s --retries=2 --start-period=10s \
CMD pgrep -f joex/lib

View File

@ -0,0 +1,18 @@
FROM alpine:latest
ARG version=
ARG restserver_url=
RUN apk add --no-cache openjdk11 bash tzdata
WORKDIR /opt
RUN wget ${restserver_url:-https://github.com/eikek/docspell/releases/download/v$version/docspell-restserver-$version.zip} && \
unzip docspell-restserver-*.zip && \
rm docspell-restserver-*.zip && \
ln -snf docspell-restserver-* docspell-restserver
ENTRYPOINT ["/opt/docspell-restserver/bin/docspell-restserver"]
EXPOSE 7880
HEALTHCHECK --interval=1m --timeout=10s --retries=2 --start-period=30s \
CMD wget --spider http://localhost:7880

View File

@ -0,0 +1,35 @@
FROM alpine:latest
# Builds an image where all scripts in tools/ are in PATH. There are
# no assumptions what script to run, so there are no CMD or
# ENTRYPOINTS defined.
#
# The scripts are named is in tools/ only prefixed by `ds-`
#
# Run the export-files script, for example:
#
# docker run -e DS_USER=demo -e DS_PASS=test docspell/tools:dev ds-export-files "http://localhost" .
#
# The build requires to either specify a version build argument or a
# tools_url build argument. If a tools_url argument is given, then
# this url is used to download the tools zip file. Otherwise the
# version argument is used to download from github.
LABEL maintainer="eikek0 <eike@docspell.org>"
ARG version=
ARG tools_url=
RUN apk add --no-cache curl bash inotify-tools jq sqlite
WORKDIR /opt
RUN wget ${tools_url:-https://github.com/eikek/docspell/releases/download/v$version/docspell-tools-$version.zip} && \
unzip docspell-tools-*.zip && \
rm docspell-tools-*.zip
RUN bash -c 'while read f; do \
target="ds-$(basename "$f" ".sh")"; \
echo "Installing $f -> $target"; \
cp "$f" "/usr/local/bin/$target"; \
chmod 755 "/usr/local/bin/$target"; \
done < <(find /opt/docspell-tools-* -name "*.sh" -mindepth 2 -not -path "*webextension*")'