paperless-ngx/Containerfile

71 lines
1.7 KiB
Docker

FROM docker.io/alpine:3.19 AS builder
RUN apk add --no-cache \
python3-dev \
make \
g++ \
musl-dev \
libpq-dev \
freetype-dev \
qpdf-dev \
gfortran \
cmake \
openblas-dev \
libffi-dev \
linux-headers
ENV VERSION=v2.1.3
ENV ARCHIVE=paperless-ngx-$VERSION.tar.xz
ENV SHA256_SUM=a27fd03806d6ee45c389e89e5074baddb21002c82bcf867fed2d81e36aa83d6e
RUN wget https://github.com/paperless-ngx/paperless-ngx/releases/download/$VERSION/$ARCHIVE
RUN echo "$SHA256_SUM $ARCHIVE" | sha256sum -c - || exit 1
RUN mkdir -p /install
RUN tar xf $ARCHIVE -C /install --strip 1
WORKDIR /install
RUN sed '/mysqlclient/d' -i requirements.txt
# RUN sed 's/scipy==1.8.1/scipy==1.11.2/g' -i requirements.txt
RUN sed 's/\(\["file_paperless\|\["file_mail\|\["file_celery\)/\["console/g' -i src/paperless/settings.py
RUN sed '/os\.makedirs(LOGGING_DIR, exist_ok=True)/d' -i src/paperless/settings.py
RUN python3 -m venv env
RUN env/bin/pip3 install -r requirements.txt
FROM docker.io/thallian/alpine-s6:3.19-3.1.6.2
RUN addgroup -g 2222 paperless
RUN adduser -h /var/lib/paperless -u 2222 -D -G paperless paperless
RUN apk add --no-cache \
python3 \
libpq \
freetype \
qpdf \
imagemagick \
ghostscript \
libmagic \
gpg \
tesseract-ocr \
tesseract-ocr-data-deu \
tesseract-ocr-data-eng \
tesseract-ocr-data-osd \
unpaper \
font-liberation \
poppler-utils
COPY --from=builder /install /var/lib/paperless
ADD /rootfs /
RUN mkdir /var/lib/paperless/consume
RUN mkdir /var/lib/paperless/data
RUN mkdir /var/lib/paperless/media
RUN chown -R paperless:paperless /var/lib/paperless
ENV HOME /var/lib/paperless
ENV S6_CMD_WAIT_FOR_SERVICES_MAXTIME=20000
VOLUME ["/var/lib/paperless/media", "/var/lib/paperless/consume", "/var/lib/paperless/data"]
EXPOSE 8000