2019-09-04 23:00:34 +02:00
|
|
|
FROM alpine:3.10
|
2017-12-12 23:12:34 +02:00
|
|
|
|
2019-03-05 21:54:59 +01:00
|
|
|
LABEL maintainer="The Paperless Project https://github.com/the-paperless-project/paperless" \
|
2018-01-29 23:19:06 +02:00
|
|
|
contributors="Guy Addadi <addadi@gmail.com>, Pit Kleyersburg <pitkley@googlemail.com>, \
|
|
|
|
|
Sven Fischer <git-dev@linux4tw.de>"
|
|
|
|
|
|
2019-08-09 13:39:57 -09:00
|
|
|
# Copy Pipfiles file, init script and gunicorn.conf
|
2018-12-30 17:31:26 +00:00
|
|
|
COPY Pipfile* /usr/src/paperless/
|
2017-12-11 22:03:51 +02:00
|
|
|
COPY scripts/docker-entrypoint.sh /sbin/docker-entrypoint.sh
|
2019-08-09 13:39:57 -09:00
|
|
|
COPY scripts/gunicorn.conf /usr/src/paperless/
|
2017-12-12 23:12:34 +02:00
|
|
|
|
|
|
|
|
# Set export and consumption directories
|
|
|
|
|
ENV PAPERLESS_EXPORT_DIR=/export \
|
|
|
|
|
PAPERLESS_CONSUMPTION_DIR=/consume
|
|
|
|
|
|
2019-02-15 12:16:56 +01:00
|
|
|
RUN apk add --no-cache \
|
|
|
|
|
bash \
|
|
|
|
|
curl \
|
|
|
|
|
ghostscript \
|
|
|
|
|
gnupg \
|
|
|
|
|
imagemagick \
|
|
|
|
|
libmagic \
|
|
|
|
|
libpq \
|
|
|
|
|
optipng \
|
|
|
|
|
poppler \
|
|
|
|
|
python3 \
|
|
|
|
|
shadow \
|
|
|
|
|
sudo \
|
|
|
|
|
tesseract-ocr \
|
|
|
|
|
unpaper && \
|
|
|
|
|
apk add --no-cache --virtual .build-dependencies \
|
|
|
|
|
g++ \
|
|
|
|
|
gcc \
|
|
|
|
|
jpeg-dev \
|
|
|
|
|
musl-dev \
|
|
|
|
|
poppler-dev \
|
|
|
|
|
postgresql-dev \
|
|
|
|
|
python3-dev \
|
|
|
|
|
zlib-dev && \
|
2017-12-12 23:12:34 +02:00
|
|
|
# Install python dependencies
|
2017-12-11 22:03:51 +02:00
|
|
|
python3 -m ensurepip && \
|
|
|
|
|
rm -r /usr/lib/python*/ensurepip && \
|
2017-12-12 23:12:34 +02:00
|
|
|
cd /usr/src/paperless && \
|
2018-12-30 17:31:26 +00:00
|
|
|
pip3 install --upgrade pip pipenv && \
|
|
|
|
|
pipenv install --system --deploy && \
|
2017-12-11 22:03:51 +02:00
|
|
|
# Remove build dependencies
|
|
|
|
|
apk del .build-dependencies && \
|
|
|
|
|
# Create the consumption directory
|
|
|
|
|
mkdir -p $PAPERLESS_CONSUMPTION_DIR && \
|
Add Dockerfile for application and documentation
This commit adds a `Dockerfile` to the root of the project, accompanied
by a `docker-compose.yml.example` for simplified deployment. The
`Dockerfile` is agnostic to whether it will be the webserver, the
consumer, or if it is run for a one-off command (i.e. creation of a
superuser, migration of the database, document export, ...).
The containers entrypoint is the `scripts/docker-entrypoint.sh` script.
This script verifies that the required permissions are set, remaps the
default users and/or groups id if required and installs additional
languages if the user wishes to.
After initialization, it analyzes the command the user supplied:
- If the command starts with a slash, it is expected that the user
wants to execute a binary file and the command will be executed
without further intervention. (Using `exec` to effectively replace
the started shell-script and not have any reaping-issues.)
- If the command does not start with a slash, the command will be
passed directly to the `manage.py` script without further
modification. (Again using `exec`.)
The default command is set to `--help`.
If the user wants to execute a command that is not meant for `manage.py`
but doesn't start with a slash, the Docker `--entrypoint` parameter can
be used to circumvent the mechanics of `docker-entrypoint.sh`.
Further information can be found in `docs/setup.rst` and in
`docs/migrating.rst`.
For additional convenience, a `Dockerfile` has been added to the `docs/`
directory which allows for easy building and serving of the
documentation. This is documented in `docs/requirements.rst`.
2016-02-17 18:45:04 +01:00
|
|
|
# Create user
|
2017-12-11 22:03:51 +02:00
|
|
|
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 && \
|
Add Dockerfile for application and documentation
This commit adds a `Dockerfile` to the root of the project, accompanied
by a `docker-compose.yml.example` for simplified deployment. The
`Dockerfile` is agnostic to whether it will be the webserver, the
consumer, or if it is run for a one-off command (i.e. creation of a
superuser, migration of the database, document export, ...).
The containers entrypoint is the `scripts/docker-entrypoint.sh` script.
This script verifies that the required permissions are set, remaps the
default users and/or groups id if required and installs additional
languages if the user wishes to.
After initialization, it analyzes the command the user supplied:
- If the command starts with a slash, it is expected that the user
wants to execute a binary file and the command will be executed
without further intervention. (Using `exec` to effectively replace
the started shell-script and not have any reaping-issues.)
- If the command does not start with a slash, the command will be
passed directly to the `manage.py` script without further
modification. (Again using `exec`.)
The default command is set to `--help`.
If the user wants to execute a command that is not meant for `manage.py`
but doesn't start with a slash, the Docker `--entrypoint` parameter can
be used to circumvent the mechanics of `docker-entrypoint.sh`.
Further information can be found in `docs/setup.rst` and in
`docs/migrating.rst`.
For additional convenience, a `Dockerfile` has been added to the `docs/`
directory which allows for easy building and serving of the
documentation. This is documented in `docs/requirements.rst`.
2016-02-17 18:45:04 +01:00
|
|
|
# Setup entrypoint
|
2017-12-11 22:03:51 +02:00
|
|
|
chmod 755 /sbin/docker-entrypoint.sh
|
2017-12-12 23:12:34 +02:00
|
|
|
|
2017-12-11 22:03:51 +02:00
|
|
|
WORKDIR /usr/src/paperless/src
|
2017-12-12 23:12:34 +02:00
|
|
|
# Mount volumes and set Entrypoint
|
2017-04-08 23:58:21 +02:00
|
|
|
VOLUME ["/usr/src/paperless/data", "/usr/src/paperless/media", "/consume", "/export"]
|
Add Dockerfile for application and documentation
This commit adds a `Dockerfile` to the root of the project, accompanied
by a `docker-compose.yml.example` for simplified deployment. The
`Dockerfile` is agnostic to whether it will be the webserver, the
consumer, or if it is run for a one-off command (i.e. creation of a
superuser, migration of the database, document export, ...).
The containers entrypoint is the `scripts/docker-entrypoint.sh` script.
This script verifies that the required permissions are set, remaps the
default users and/or groups id if required and installs additional
languages if the user wishes to.
After initialization, it analyzes the command the user supplied:
- If the command starts with a slash, it is expected that the user
wants to execute a binary file and the command will be executed
without further intervention. (Using `exec` to effectively replace
the started shell-script and not have any reaping-issues.)
- If the command does not start with a slash, the command will be
passed directly to the `manage.py` script without further
modification. (Again using `exec`.)
The default command is set to `--help`.
If the user wants to execute a command that is not meant for `manage.py`
but doesn't start with a slash, the Docker `--entrypoint` parameter can
be used to circumvent the mechanics of `docker-entrypoint.sh`.
Further information can be found in `docs/setup.rst` and in
`docs/migrating.rst`.
For additional convenience, a `Dockerfile` has been added to the `docs/`
directory which allows for easy building and serving of the
documentation. This is documented in `docs/requirements.rst`.
2016-02-17 18:45:04 +01:00
|
|
|
ENTRYPOINT ["/sbin/docker-entrypoint.sh"]
|
|
|
|
|
CMD ["--help"]
|
2018-02-01 13:02:48 +00:00
|
|
|
|
2018-07-05 12:56:37 +02:00
|
|
|
# Copy application
|
|
|
|
|
COPY src/ /usr/src/paperless/src/
|
|
|
|
|
COPY data/ /usr/src/paperless/data/
|
|
|
|
|
COPY media/ /usr/src/paperless/media/
|
|
|
|
|
|
2019-08-30 22:38:38 +02:00
|
|
|
# Collect static files
|
|
|
|
|
RUN sudo -HEu paperless /usr/src/paperless/src/manage.py collectstatic --clear --no-input
|