Mount config file in predictable location in docker container
This commit is contained in:
		
							parent
							
								
									7f4c12ab9b
								
							
						
					
					
						commit
						2ddd7c1cec
					
				|  | @ -1,4 +1,4 @@ | ||||||
| #!/bin/bash -e | #!/bin/bash -eu | ||||||
| DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||||||
| 
 | 
 | ||||||
| BUILD_OPTS="$*" | BUILD_OPTS="$*" | ||||||
|  | @ -62,10 +62,14 @@ if [ "${CONTAINER_EXISTS}" != "" ] && [ "${CONTINUE}" != "1" ]; then | ||||||
| 	exit 1 | 	exit 1 | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
|  | # Modify original build-options to allow config file to be mounted in the docker container | ||||||
|  | BUILD_OPTS="$(echo ${BUILD_OPTS:-} | sed -r 's@\-c\s?([^ ]+)@-c /config@')" | ||||||
|  | 
 | ||||||
| ${DOCKER} build -t pi-gen "${DIR}" | ${DOCKER} build -t pi-gen "${DIR}" | ||||||
| if [ "${CONTAINER_EXISTS}" != "" ]; then | if [ "${CONTAINER_EXISTS}" != "" ]; then | ||||||
| 	trap 'echo "got CTRL+C... please wait 5s" && ${DOCKER} stop -t 5 ${CONTAINER_NAME}_cont' SIGINT SIGTERM | 	trap 'echo "got CTRL+C... please wait 5s" && ${DOCKER} stop -t 5 ${CONTAINER_NAME}_cont' SIGINT SIGTERM | ||||||
| 	time ${DOCKER} run --rm --privileged \ | 	time ${DOCKER} run --rm --privileged \ | ||||||
|  | 		--volume "${CONFIG_FILE}":/config:ro \ | ||||||
| 		--volumes-from="${CONTAINER_NAME}" --name "${CONTAINER_NAME}_cont" \ | 		--volumes-from="${CONTAINER_NAME}" --name "${CONTAINER_NAME}_cont" \ | ||||||
| 		pi-gen \ | 		pi-gen \ | ||||||
| 		bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static && | 		bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static && | ||||||
|  | @ -75,6 +79,7 @@ if [ "${CONTAINER_EXISTS}" != "" ]; then | ||||||
| else | else | ||||||
| 	trap 'echo "got CTRL+C... please wait 5s" && ${DOCKER} stop -t 5 ${CONTAINER_NAME}' SIGINT SIGTERM | 	trap 'echo "got CTRL+C... please wait 5s" && ${DOCKER} stop -t 5 ${CONTAINER_NAME}' SIGINT SIGTERM | ||||||
| 	time ${DOCKER} run --name "${CONTAINER_NAME}" --privileged \ | 	time ${DOCKER} run --name "${CONTAINER_NAME}" --privileged \ | ||||||
|  | 		--volume "${CONFIG_FILE}":/config:ro \ | ||||||
| 		pi-gen \ | 		pi-gen \ | ||||||
| 		bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static && | 		bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static && | ||||||
| 	cd /pi-gen; ./build.sh ${BUILD_OPTS} && | 	cd /pi-gen; ./build.sh ${BUILD_OPTS} && | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user