This repository has been archived by the owner on Feb 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 353
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jonas Winkler
committed
Oct 28, 2020
1 parent
03bd2b7
commit 70c1a0e
Showing
4 changed files
with
170 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,71 @@ | ||
FROM alpine:3.11 | ||
############################################################################### | ||
### Front end ### | ||
############################################################################### | ||
|
||
LABEL maintainer="The Paperless Project https://github.com/the-paperless-project/paperless" \ | ||
contributors="Guy Addadi <[email protected]>, Pit Kleyersburg <[email protected]>, \ | ||
Sven Fischer <[email protected]>" | ||
FROM node:current AS frontend | ||
|
||
WORKDIR /usr/src/paperless/src-ui/ | ||
|
||
COPY src-ui/package* ./ | ||
RUN npm install | ||
|
||
COPY src-ui . | ||
RUN node_modules/.bin/ng build --prod --output-hashing none | ||
|
||
############################################################################### | ||
### Back end ### | ||
############################################################################### | ||
|
||
FROM python:3.8-slim | ||
|
||
WORKDIR /usr/src/paperless/ | ||
|
||
COPY Pipfile* ./ | ||
|
||
#Dependencies | ||
RUN apt-get update \ | ||
&& apt-get -y --no-install-recommends install \ | ||
build-essential \ | ||
curl \ | ||
ghostscript \ | ||
gnupg \ | ||
imagemagick \ | ||
libmagic-dev \ | ||
libpoppler-cpp-dev \ | ||
libpq-dev \ | ||
optipng \ | ||
sudo \ | ||
tesseract-ocr \ | ||
tesseract-ocr-eng \ | ||
tesseract-ocr-deu \ | ||
tesseract-ocr-fra \ | ||
tesseract-ocr-ita \ | ||
tesseract-ocr-spa \ | ||
tzdata \ | ||
unpaper \ | ||
&& pip install --upgrade pipenv \ | ||
&& pipenv install --system --deploy \ | ||
&& apt-get -y purge build-essential \ | ||
&& apt-get -y autoremove --purge \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# # Copy application | ||
COPY scripts/gunicorn.conf.py ./ | ||
COPY src/ ./src/ | ||
COPY --from=frontend /usr/src/paperless/src-ui/dist/paperless-ui/ ./src/documents/static/ | ||
|
||
RUN addgroup --gid 1000 paperless && \ | ||
useradd --uid 1000 --gid paperless --home-dir /usr/src/paperless paperless && \ | ||
chown -R paperless:paperless . | ||
|
||
WORKDIR /usr/src/paperless/src/ | ||
|
||
RUN sudo -HEu paperless python3 manage.py collectstatic --clear --no-input | ||
|
||
VOLUME ["/usr/src/paperless/data", "/usr/src/paperless/consume", "/usr/src/paperless/export"] | ||
|
||
# Copy Pipfiles file, init script and gunicorn.conf | ||
COPY Pipfile* /usr/src/paperless/ | ||
COPY scripts/docker-entrypoint.sh /sbin/docker-entrypoint.sh | ||
COPY scripts/gunicorn.conf /usr/src/paperless/ | ||
|
||
# Set export and consumption directories | ||
ENV PAPERLESS_EXPORT_DIR=/export \ | ||
PAPERLESS_CONSUMPTION_DIR=/consume | ||
|
||
RUN apk add --no-cache \ | ||
bash \ | ||
curl \ | ||
ghostscript \ | ||
gnupg \ | ||
imagemagick \ | ||
libmagic \ | ||
libpq \ | ||
optipng \ | ||
poppler \ | ||
python3 \ | ||
shadow \ | ||
sudo \ | ||
tesseract-ocr \ | ||
tzdata \ | ||
unpaper && \ | ||
apk add --no-cache --virtual .build-dependencies \ | ||
g++ \ | ||
gcc \ | ||
jpeg-dev \ | ||
musl-dev \ | ||
poppler-dev \ | ||
postgresql-dev \ | ||
python3-dev \ | ||
zlib-dev && \ | ||
# Install python dependencies | ||
python3 -m ensurepip && \ | ||
rm -r /usr/lib/python*/ensurepip && \ | ||
cd /usr/src/paperless && \ | ||
pip3 install --upgrade pip pipenv && \ | ||
pipenv install --system --deploy && \ | ||
# Remove build dependencies | ||
apk del .build-dependencies && \ | ||
# Create the consumption directory | ||
mkdir -p $PAPERLESS_CONSUMPTION_DIR && \ | ||
# Create user | ||
addgroup -g 1000 paperless && \ | ||
adduser -D -u 1000 -G paperless -h /usr/src/paperless paperless && \ | ||
chown -Rh paperless:paperless /usr/src/paperless && \ | ||
mkdir -p $PAPERLESS_EXPORT_DIR && \ | ||
# Avoid setrlimit warnings | ||
# See: https://gitlab.alpinelinux.org/alpine/aports/issues/11122 | ||
echo 'Set disable_coredump false' >> /etc/sudo.conf && \ | ||
# Setup entrypoint | ||
chmod 755 /sbin/docker-entrypoint.sh | ||
|
||
WORKDIR /usr/src/paperless/src | ||
# Mount volumes and set Entrypoint | ||
VOLUME ["/usr/src/paperless/data", "/usr/src/paperless/media", "/consume", "/export"] | ||
RUN chmod 755 /sbin/docker-entrypoint.sh | ||
ENTRYPOINT ["/sbin/docker-entrypoint.sh"] | ||
CMD ["--help"] | ||
|
||
# Copy application | ||
COPY src/ /usr/src/paperless/src/ | ||
COPY data/ /usr/src/paperless/data/ | ||
COPY media/ /usr/src/paperless/media/ | ||
|
||
# Collect static files | ||
RUN sudo -HEu paperless /usr/src/paperless/src/manage.py collectstatic --clear --no-input | ||
CMD ["--help"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,35 @@ | ||
PAPERLESS_DBENGINE="django.db.backends.postgresql_psycopg2" | ||
PAPERLESS_DBHOST="db" | ||
PAPERLESS_DBNAME="paperless" | ||
PAPERLESS_DBUSER="paperless" | ||
PAPERLESS_DBPASS="paperless" | ||
|
||
PAPERLESS_CONSUMPTION_DIR="../consume" | ||
|
||
# Environment variables to set for Paperless | ||
# Commented out variables will be replaced with a default within Paperless. | ||
# | ||
# In addition to what you see here, you can also define any values you find in | ||
# paperless.conf.example here. Values like: | ||
# | ||
# * PAPERLESS_PASSPHRASE | ||
# * PAPERLESS_CONSUMPTION_DIR | ||
# * PAPERLESS_CONSUME_MAIL_HOST | ||
# | ||
# ...are all explained in that file but can be defined here, since the Docker | ||
# installation doesn't make use of paperless.conf. | ||
|
||
# Use this variable to set a timezone for the Paperless Docker containers. If not specified, defaults to UTC. | ||
# TZ=America/Los_Angeles | ||
#TZ=America/Los_Angeles | ||
|
||
# Additional languages to install for text recognition. Note that this is | ||
# different from PAPERLESS_OCR_LANGUAGE (default=eng), which defines the | ||
# default language used when guessing the language from the OCR output. | ||
# PAPERLESS_OCR_LANGUAGES=deu ita | ||
|
||
# Set Paperless to use SSL for the web interface. | ||
# Enabling this will require ssl.key and ssl.cert files in paperless' data directory. | ||
# PAPERLESS_USE_SSL=false | ||
# The container installs English, German, Italian, Spanish and French by | ||
# default. | ||
#PAPERLESS_OCR_LANGUAGES=deu ita spa fra | ||
|
||
# You can change the default user and group id to a custom one | ||
# USERMAP_UID=1000 | ||
# USERMAP_GID=1000 | ||
# The UID and GID of the user used to run paperless in the container. Set this | ||
# to your UID and GID on the host so that you have write access to the | ||
# consumption directory. | ||
#USERMAP_UID=1000 | ||
#USERMAP_GID=1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,44 @@ | ||
version: '2.1' | ||
|
||
version: "3.8" | ||
services: | ||
webserver: | ||
build: ./ | ||
# uncomment the following line to start automatically on system boot | ||
# restart: always | ||
ports: | ||
# You can adapt the port you want Paperless to listen on by | ||
# modifying the part before the `:`. | ||
- "8000:8000" | ||
healthcheck: | ||
test: ["CMD", "curl" , "-f", "http://localhost:8000"] | ||
interval: 30s | ||
timeout: 10s | ||
retries: 5 | ||
volumes: | ||
- data:/usr/src/paperless/data | ||
- media:/usr/src/paperless/media | ||
# You have to adapt the local path you want the consumption | ||
# directory to mount to by modifying the part before the ':'. | ||
- ./consume:/consume | ||
env_file: docker-compose.env | ||
# The reason the line is here is so that the webserver that doesn't do | ||
# any text recognition and doesn't have to install unnecessary | ||
# languages the user might have set in the env-file by overwriting the | ||
# value with nothing. | ||
environment: | ||
- PAPERLESS_OCR_LANGUAGES= | ||
command: ["gunicorn", "-b", "0.0.0.0:8000"] | ||
db: | ||
image: postgres:13 | ||
#restart: always | ||
environment: | ||
POSTGRES_DB: paperless | ||
POSTGRES_USER: paperless | ||
POSTGRES_PASSWORD: paperless | ||
|
||
webserver: | ||
build: . | ||
image: paperless_app | ||
#restart: always | ||
depends_on: | ||
- db | ||
ports: | ||
- "8000:8000" | ||
healthcheck: | ||
test: ["CMD", "curl", "-f", "http://localhost:8000"] | ||
interval: 30s | ||
timeout: 10s | ||
retries: 5 | ||
volumes: | ||
- data:/usr/src/paperless/data | ||
env_file: docker-compose.env | ||
environment: | ||
- PAPERLESS_OCR_LANGUAGES= | ||
command: ["gunicorn", "-b", "0.0.0.0:8000"] | ||
|
||
consumer: | ||
build: ./ | ||
# uncomment the following line to start automatically on system boot | ||
# restart: always | ||
depends_on: | ||
webserver: | ||
condition: service_healthy | ||
volumes: | ||
- data:/usr/src/paperless/data | ||
- media:/usr/src/paperless/media | ||
# This should be set to the same value as the consume directory | ||
# in the webserver service above. | ||
- ./consume:/consume | ||
# Likewise, you can add a local path to mount a directory for | ||
# exporting. This is not strictly needed for paperless to | ||
# function, only if you're exporting your files: uncomment | ||
# it and fill in a local path if you know you're going to | ||
# want to export your documents. | ||
# - /path/to/another/arbitrary/place:/export | ||
env_file: docker-compose.env | ||
command: ["document_consumer"] | ||
consumer: | ||
image: paperless_app | ||
depends_on: | ||
- webserver | ||
- db | ||
restart: on-failure:5 | ||
volumes: | ||
- data:/usr/src/paperless/data | ||
- ./consume:/usr/src/paperless/consume | ||
env_file: docker-compose.env | ||
command: ["document_consumer"] | ||
|
||
volumes: | ||
data: | ||
media: | ||
data: |
Oops, something went wrong.