diff --git a/README.md b/README.md index 5ea3ee2..2d9efc9 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,18 @@ ### Configuration By default, Android SDK is expected under `~/android/sdk`. -It is possible to adapt this path in `docker-compose.yml`. -But it may also be specified in your `local.properties`! +It is possible to adapt this path in `local.properties` (not to be committed). + ### Usage +If the current user id and group id are not 1000, it is required to define them using environment variables: + +``` +export _UID="$(id -u)" +export _GID="$(id -g)" +``` + The following command should build (if required) and start a shell session inside the container: ``` diff --git a/lazyDir/centos7.Dockerfile b/lazyDir/centos7.Dockerfile index 75d1e0d..4099adb 100644 --- a/lazyDir/centos7.Dockerfile +++ b/lazyDir/centos7.Dockerfile @@ -127,9 +127,10 @@ ARG gid=1000 ARG group=android -# Add user to build -RUN groupadd -g "${gid}" "${group}" && \ - useradd -ms /bin/bash -g "${group}" -u "${uid}" "${user}" +# Add or modify user and group for build and runtime (convenient) +RUN id ${user} > /dev/null 2>&1 && \ + { groupmod -g "${gid}" "${group}" && usermod -md /home/${user} -s /bin/bash -g "${group}" -u "${uid}" "${user}"; } || \ + { groupadd -g "${gid}" "${group}" && useradd -md /home/${user} -s /bin/bash -g "${group}" -u "${uid}" "${user}"; } # Copy requirements in non-root user home directory COPY Gemfile Gemfile.lock "/home/${user}/"