Implement script to start container with pwd mounted on it
This commit is contained in:
		
							
								
								
									
										25
									
								
								debian-here.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										25
									
								
								debian-here.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					#!/usr/bin/env bash
 | 
				
			||||||
 | 
					set -eu
 | 
				
			||||||
 | 
					set -o pipefail
 | 
				
			||||||
 | 
					set -o errtrace
 | 
				
			||||||
 | 
					shopt -s expand_aliases
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					pushd() { command pushd "$@" > /dev/null; }
 | 
				
			||||||
 | 
					popd() { command popd "$@" > /dev/null; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					here="$(pwd)"
 | 
				
			||||||
 | 
					script_dir="$(dirname "$(readlink -f "$0")")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					run() {
 | 
				
			||||||
 | 
					    if [[ ! -z ${BUILD:-} ]];then
 | 
				
			||||||
 | 
					        pushd "$script_dir"
 | 
				
			||||||
 | 
					        docker build -t debian-here .
 | 
				
			||||||
 | 
					        popd
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    mount_point="/mnt/$(basename "$here")"
 | 
				
			||||||
 | 
					    docker run --rm -ti -v "$here":"$mount_point" -w "$mount_point" debian-here /bin/zsh
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					run
 | 
				
			||||||
		Reference in New Issue
	
	Block a user