53 lines
		
	
	
		
			911 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			53 lines
		
	
	
		
			911 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/bin/bash
 | |
| # -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
 | |
| source /etc/ulibauto || exit 1
 | |
| cd "$scriptdir"
 | |
| 
 | |
| NAME=nutools
 | |
| BUILDDIR=b
 | |
| TRANSDIR="$BUILDDIR/t"
 | |
| ENVDIR=..
 | |
| 
 | |
| function display_help() {
 | |
|     uecho "$scriptname: construire $NAME
 | |
| 
 | |
| USAGE
 | |
|     $scriptname [options]
 | |
| 
 | |
| OPTIONS
 | |
|     -b, --build
 | |
|     -n, --no-cache"
 | |
| }
 | |
| 
 | |
| auto=1
 | |
| prereqs=
 | |
| build=
 | |
| no_cache=
 | |
| args=(
 | |
|     --help '$exit_with display_help'
 | |
|     --prereqs '$prereqs=1; auto='
 | |
|     -b,--build '$build=1; auto='
 | |
|     -n,--no-cache no_cache=1
 | |
| )
 | |
| parse_args "$@"; set -- "${args[@]}"
 | |
| 
 | |
| if [ -n "$prereqs" ]; then
 | |
|     build=
 | |
| elif [ -n "$auto" ]; then
 | |
|     build=1
 | |
| fi
 | |
| 
 | |
| if [ -n "$build" ]; then
 | |
|     setx date=date +%y%m%d
 | |
|     args=(
 | |
|         -f Dockerfile
 | |
|         -t $NAME:latest
 | |
|         --build-arg "date=$date"
 | |
|         ${no_cache:+--no-cache}
 | |
|     )
 | |
| 
 | |
|     etitle "Création de l'image docker $NAME"
 | |
|     docker build "${args[@]}" "$ENVDIR"
 | |
|     eend
 | |
| fi
 |