mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	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`.
			
			
This commit is contained in:
		
							
								
								
									
										23
									
								
								src/documents/management/commands/loaddata_stdin.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								src/documents/management/commands/loaddata_stdin.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | ||||
| """ | ||||
| Source: | ||||
|     https://gist.github.com/bmispelon/ad5a2c333443b3a1d051 | ||||
|  | ||||
| License: | ||||
|     MIT | ||||
|     Copyright (c) 2016 Baptiste Mispelon | ||||
| """ | ||||
| import sys | ||||
|  | ||||
| from django.core.management.commands.loaddata import Command as LoadDataCommand | ||||
|  | ||||
|  | ||||
| class Command(LoadDataCommand): | ||||
|     def parse_name(self, fixture_name): | ||||
|         self.compression_formats['stdin'] = (lambda x,y: sys.stdin, None) | ||||
|         if fixture_name == '-': | ||||
|             return '-', 'json', 'stdin' | ||||
|  | ||||
|     def find_fixtures(self, fixture_label): | ||||
|         if fixture_label == '-': | ||||
|             return [('-', None, '-')] | ||||
|         return super(Command, self).find_fixtures(fixture_label) | ||||
		Reference in New Issue
	
	Block a user
	 Pit Kleyersburg
					Pit Kleyersburg