1
0
mirror of https://github.com/stucki/docker-lineageos synced 2024-12-19 17:12:29 -05:00

Merge pull request #38 from bebehei/docker-build-pull

Run docker pull during build and simplify code
This commit is contained in:
Michael Stucki 2017-05-30 15:57:39 +02:00 committed by GitHub
commit b102c73096

13
run.sh
View File

@ -39,14 +39,13 @@ if [ $? -ne 0 ]; then
echo "docker command not found" echo "docker command not found"
exit $? exit $?
elif [[ $FORCE_BUILD = 1 ]] || ! echo "$IMAGE_EXISTS" | grep -q "$TAG"; then elif [[ $FORCE_BUILD = 1 ]] || ! echo "$IMAGE_EXISTS" | grep -q "$TAG"; then
# Pull Ubuntu image to be sure it's up to date
echo "Fetching Docker \"ubuntu\" image..."
docker pull ubuntu:16.04
echo "Building Docker image $REPOSITORY:$TAG..." echo "Building Docker image $REPOSITORY:$TAG..."
USERID=$(id -u) docker build \
GROUPID=$(id -g) --pull \
docker build -t $REPOSITORY:$TAG --build-arg hostuid=$USERID --build-arg hostgid=$GROUPID . -t $REPOSITORY:$TAG \
--build-arg hostuid=$(id -u) \
--build-arg hostgid=$(id -g) \
.
# After successful build, delete existing containers # After successful build, delete existing containers
IS_EXISTING=$(docker inspect -f '{{.Id}}' $CONTAINER 2>/dev/null) || true IS_EXISTING=$(docker inspect -f '{{.Id}}' $CONTAINER 2>/dev/null) || true