[jvm-packages] Launch dev jvm image under my user (#4676)

Co-authored-by: Philip Hyunsu Cho <chohyu01@cs.washington.edu>
This commit is contained in:
Oleksandr Pryimak 2022-03-23 10:39:51 -07:00 committed by GitHub
parent c92ab2ce49
commit f5b20286e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 4 deletions

View File

@ -47,4 +47,12 @@ ENV JAVA_HOME=/usr/lib/jvm/java
RUN \
pip install numpy pytest scipy scikit-learn wheel kubernetes urllib3==1.22 awscli
ENV GOSU_VERSION 1.10
# Install lightweight sudo (not bound to TTY)
RUN set -ex; \
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-amd64" && \
chmod +x /usr/local/bin/gosu && \
gosu nobody true
WORKDIR /xgboost

View File

@ -21,14 +21,21 @@ BASEDIR="$( cd "$( dirname "$0" )" && pwd )" # the directory of this file
docker build -t dmlc/xgboost4j-build "${BASEDIR}" # build and tag the Dockerfile
docker run \
exec docker run \
-it \
--rm \
--memory 12g \
--env JAVA_OPTS="-Xmx9g" \
--env MAVEN_OPTS="-Xmx3g" \
--env MAVEN_OPTS="-Xmx3g -Dmaven.repo.local=/xgboost/jvm-packages/dev/.m2" \
--env CI_BUILD_UID=`id -u` \
--env CI_BUILD_GID=`id -g` \
--env CI_BUILD_USER=`id -un` \
--env CI_BUILD_GROUP=`id -gn` \
--ulimit core=-1 \
--volume "${BASEDIR}/../..":/xgboost \
--volume "${BASEDIR}/.m2":/root/.m2 \
dmlc/xgboost4j-build \
/xgboost/jvm-packages/dev/package-linux.sh "$@"
/xgboost/tests/ci_build/entrypoint.sh jvm-packages/dev/package-linux.sh "$@"
# CI_BUILD_UID, CI_BUILD_GID, CI_BUILD_USER, CI_BUILD_GROUP
# are used by entrypoint.sh to create the user with the same uid in a container
# so all produced artifacts would be owned by your host user