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


##########
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}"
+M2_DIR="${HOME}/.m2"
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
+cd "$SCRIPT_DIR" || exit 1
+
+# Build the image if needed
+if [[ $(docker images -q $IMAGE) == "" ]]; then
+  cd docker || exit 1
+  docker build --build-arg uid="$(id -u "${USER}")" --build-arg gid="$(id -g 
"${USER}")" -t $IMAGE .
+  cd "$SCRIPT_DIR" || exit 1
+fi
+
+# Need absolute paths for Docker volume mounts
+cd .. || exit 1
+SOURCE_DIR=$(pwd)
+cd "$SCRIPT_DIR" || exit 1
+
+docker run --rm -v "$M2_DIR":/home/builder/.m2 -v "$SOURCE_DIR":/SOURCES 
$IMAGE /bin/bash -c 'cd /SOURCES && rm -rf core/src/main/thrift-gen-java && mvn 
-Pthrift generate-sources && mvn clean package'

Review Comment:
   > why is it deleting core/src/main/thrift-gen-java (the generate-thrift.sh 
script already does that)
   
   I didn't know that, I can remove that.
   
   > Is the expectation that the thrift files are no longer checked in? Or are 
they still checked in? If they are still checked in, when do they get replaced?
   
   They are still checked in, but hidden in the diff by the .gitattributes 
file. I didn't know that the `thrift` profile removed the files and regenerated 
them.
   
   > I thought "what happens inside docker container stays inside docker 
container"
   
   Not necessarily. In this case I am mounting (-v) the local `.m2` directory 
to `/home/builder/.m2` in the container, and I'm mounting the local `accumulo` 
directory at `/SOURCES` in the container. When the image is built, I am using 
your uid and gid for the `builder` user, so any reads/writes to the local 
filesystem (either to .m2/repository or to the `accumulo` local workspace) wont 
run into permission issues.
   



-- 
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