mirror of
https://github.com/stucki/docker-lineageos
synced 2025-01-09 17:39:47 -05:00
Add -f switch, dont remove containers
This commit is contained in:
parent
5ce063e15a
commit
ae71c4c41b
3
CHANGELOG.md
Normal file → Executable file
3
CHANGELOG.md
Normal file → Executable file
@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [Unreleased][unreleased]
|
||||
### Added
|
||||
- Use -f to force rebuild the source.
|
||||
- If build fails don't remove intermediate containers
|
||||
|
||||
## [0.5.0] - 2016-03-14
|
||||
### Added
|
||||
|
28
run.sh
28
run.sh
@ -2,14 +2,31 @@
|
||||
|
||||
cd $(dirname $0)
|
||||
|
||||
SOURCE=$(pwd)/android
|
||||
CCACHE=$(pwd)/ccache
|
||||
SOURCE=$(readlink -f $(pwd)/android)
|
||||
CCACHE=$(readlink -f $(pwd)/ccache)
|
||||
CONTAINER_HOME=/home/cmbuild
|
||||
CONTAINER=cyanogenmod
|
||||
REPOSITORY=stucki/cyanogenmod
|
||||
TAG=cm-13.0
|
||||
FORCE_BUILD=0
|
||||
|
||||
|
||||
while [[ $# > 0 ]]
|
||||
do
|
||||
key="$1"
|
||||
|
||||
case $key in
|
||||
-r|--rebuild)
|
||||
FORCE_BUILD=1
|
||||
;;
|
||||
*)
|
||||
shift # past argument or value
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
|
||||
done
|
||||
|
||||
# Create shared folders
|
||||
mkdir -p $SOURCE
|
||||
mkdir -p $CCACHE
|
||||
@ -26,14 +43,19 @@ elif [[ $FORCE_BUILD = 1 ]] || ! echo "$IMAGE_EXISTS" | grep -q "$TAG"; then
|
||||
|
||||
echo "Building Docker image $REPOSITORY:$TAG..."
|
||||
docker build -t $REPOSITORY:$TAG .
|
||||
OK=$?
|
||||
|
||||
# After successful build, delete existing containers
|
||||
IS_EXISTING=$(docker inspect -f '{{.Id}}' $CONTAINER 2>/dev/null)
|
||||
if [[ -n "$IS_EXISTING" ]]; then
|
||||
if [[ $OK -eq 0 ]] && [[ -n "$IS_EXISTING" ]]; then
|
||||
docker rm $CONTAINER
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $OK -ne 0 ]]; then
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# With the given name $CONTAINER, reconnect to running container, start
|
||||
# an existing/stopped container or run a new one if one does not exist.
|
||||
IS_RUNNING=$(docker inspect -f '{{.State.Running}}' $CONTAINER 2>/dev/null)
|
||||
|
Loading…
x
Reference in New Issue
Block a user