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

Ensure build user has the same UID and GID as the host user

This prevents permission problems since volum owners are set from host
This commit is contained in:
Álvaro Brey 2017-04-19 18:10:56 +02:00
parent 98bbfc0699
commit 80042bd00f
No known key found for this signature in database
GPG Key ID: CFE28F23E51968FA
2 changed files with 10 additions and 2 deletions

View File

@ -21,7 +21,13 @@ RUN apt-get install -y android-tools-adb android-tools-fastboot
RUN apt-get install -y bc bsdmainutils file screen
RUN apt-get install -y bash-completion wget nano
RUN useradd build && rsync -a /etc/skel/ /home/build/
ARG hostuid=1000
ARG hostgid=1000
RUN \
groupadd build -g $hostgid && \
useradd build -g $hostgid -u $hostuid && \
rsync -a /etc/skel/ /home/build/
RUN mkdir /home/build/bin
RUN curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > /home/build/bin/repo

4
run.sh
View File

@ -48,7 +48,9 @@ elif [[ $FORCE_BUILD = 1 ]] || ! echo "$IMAGE_EXISTS" | grep -q "$TAG"; then
docker pull ubuntu:16.04
echo "Building Docker image $REPOSITORY:$TAG..."
docker build -t $REPOSITORY:$TAG .
USERID=$(id -u)
GROUPID=$(id -g)
docker build -t $REPOSITORY:$TAG --build-arg hostuid=$USERID --build-arg hostgid=$GROUPID .
OK=$?
# After successful build, delete existing containers