brianloss commented on code in PR #3093:
URL: https://github.com/apache/accumulo/pull/3093#discussion_r1030546646


##########
contrib/build.sh:
##########
@@ -0,0 +1,40 @@
+#! /bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+VERSION="1"
+IMAGE="accumulo-build-environment-${VERSION}"

Review Comment:
   The `-u` argument works, but since the user id doesn't exist in /etc/passwd, 
there's no home dir for the user. I was able to work around that by making a 
world writable dir in the Docker image and adding env vars HOME (pointing to 
the new dir) and MAVEN_OPTS (setting user.home to the dir). That gets the build 
to work if you don't run tests, but tests fail on setting up miniaccumulo. 
There are other workarounds where you could specify an entrypoint script that 
modifies the user, but I think it's probably better just to create a new image 
layered on top of the base image. Something like this for the user-specific 
Dockerfile:
   ```Dockerfile
   ARG DOCKER_PROXY=""
   ARG version=1
   FROM ghcr.io/apache/accumulo/accumulo-build-environment:${version}
   ARG uid
   ARG gid
   
   USER root
   
   # Update uid/gid of the builder user to the supplied ids. Handle conflicts 
by removing the conflicting user or group.
   RUN bash -c "groupmod -g ${gid} builder || (groupdel -f $(getent group 
${gid} | cut -d: -f1) && groupmod -g ${gid} builder)" && \
       bash -c "usermod -u ${uid} builder || (userdel $(id -nu ${uid}) && 
usermod -u ${uid} builder)"
   
   USER builder
   ```
   Not sure about the path to the base image--would be something like that 
depending on how it gets published.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to