mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nlp.git
				synced 2025-10-31 17:22:47 +00:00 
			
		
		
		
	Add wrapper and remove default arguments from Dockerfile
This commit is contained in:
		| @@ -38,4 +38,3 @@ COPY nlp /usr/local/bin | ||||
| COPY spacy_nlp /usr/local/bin | ||||
|  | ||||
| ENTRYPOINT ["nlp"] | ||||
| CMD ["--help"] | ||||
|   | ||||
							
								
								
									
										31
									
								
								wrapper/nlp
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										31
									
								
								wrapper/nlp
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| #!/usr/bin/env python3 | ||||
| # coding=utf-8 | ||||
|  | ||||
| import argparse | ||||
| import subprocess | ||||
|  | ||||
| container_image = 'gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/nlp:latest' | ||||
|  | ||||
| parser = argparse.ArgumentParser(add_help=False) | ||||
| parser.add_argument( | ||||
|     '-i', | ||||
|     dest='input_dir', | ||||
|     required=False | ||||
| ) | ||||
| parser.add_argument( | ||||
|     '-o', | ||||
|     dest='output_dir', | ||||
|     required=False | ||||
| ) | ||||
| args, nlp_args = parser.parse_known_args() | ||||
|  | ||||
| if args.input_dir == None or args.output_dir == None: | ||||
|     if args.input_dir != None: | ||||
|         nlp_args.append('-i') | ||||
|         nlp_args.append('/files_for_nlp') | ||||
|     if args.output_dir != None: | ||||
|         nlp_args.append('-o') | ||||
|         nlp_args.append('/files_from_nlp') | ||||
|     subprocess.run(['docker', 'run', '--rm', '-it', container_image] + nlp_args) | ||||
| else: | ||||
|     subprocess.run(['docker', 'run', '--rm', '-it', '-v', args.input_dir + ':/files_for_nlp', '-v', args.output_dir + ':/files_from_nlp', container_image, '-i', '/files_for_nlp', '-o', '/files_from_nlp'] + nlp_args) | ||||
		Reference in New Issue
	
	Block a user