Allow the uid and gid to be customizeable

Change-Id: Ib6fd0da0020ec71a9d70d96501b40e849c004531
This commit is contained in:
Sam Yaple 2018-01-10 15:43:03 -05:00
parent aeff89ce24
commit c51f595ee8
No known key found for this signature in database
GPG Key ID: 9329D8A45034DAB9
3 changed files with 7 additions and 2 deletions

View File

@ -12,6 +12,9 @@ ARG PIP_PACKAGES=""
ARG PLUGIN=no
ARG PYTHON3=no
ARG UID=42424
ARG GID=42424
COPY scripts /opt/loci/scripts
COPY bindep.txt /opt/loci/

View File

@ -60,6 +60,8 @@ For more advanced building you can use docker build arguments to define:
should contain
* `PROJECT_REF` The git ref, branch, or tag the container should fetch for
the project
* `UID` The uid of the user that will be created (defaults to 42424).
* `GID` The gid of the group that will be created (default to 42424).
* `WHEELS` The location of the wheels tarball. This accepts a url to a
tarball or a Docker image name in the form of
[myregistry/]mydockernamespace/requirements[:ubuntu]

View File

@ -2,8 +2,8 @@
set -ex
groupadd -g 42424 ${PROJECT}
useradd -u 42424 -g ${PROJECT} -M -d /var/lib/${PROJECT} -s /usr/sbin/nologin -c "${PROJECT} user" ${PROJECT}
groupadd -g ${GID} ${PROJECT}
useradd -u ${UID} -g ${PROJECT} -M -d /var/lib/${PROJECT} -s /usr/sbin/nologin -c "${PROJECT} user" ${PROJECT}
mkdir -p /etc/${PROJECT} /var/log/${PROJECT} /var/lib/${PROJECT} /var/cache/${PROJECT}
chown ${PROJECT}:${PROJECT} /etc/${PROJECT} /var/log/${PROJECT} /var/lib/${PROJECT} /var/cache/${PROJECT}