浏览代码

HPCC-23716 make platform Debug container source directory writable

This is to aide debugging processes in containers via vscode,
which requires write access to the folder it's browsing.

Signed-off-by: Jake Smith <jake.smith@lexisnexisrisk.com>
Jake Smith 5 年之前
父节点
当前提交
081321a893

+ 1 - 1
dockerfiles/incr.sh

@@ -53,7 +53,7 @@ if [[ -n "$FORCE" ]] ; then
   docker image build -t hpccsystems/platform-build:${BUILD_LABEL} --build-arg PREV_LABEL=${HEAD}-Debug --build-arg BASE_VER=7.8 --build-arg BUILD_TYPE=Debug platform-build/
 else
   PREV_COMMIT=$(echo "${PREV}" | sed -e "s/-Debug//")
-  git diff --binary ${PREV_COMMIT} > platform-build-incremental/hpcc.gitpatch
+  git diff --binary ${PREV_COMMIT} ':!./' > platform-build-incremental/hpcc.gitpatch
   # PATCH_MD5 is an ARG of the docker file, which ensures that if different from cached version, image will rebuild from that stage
   PATCH_MD5=$(md5sum platform-build-incremental/hpcc.gitpatch  | awk '{print $1}')
   docker image build -t hpccsystems/platform-build:${BUILD_LABEL} --build-arg PREV_LABEL=${PREV} --build-arg PATCH_MD5=${PATCH_MD5} platform-build-incremental/

+ 4 - 0
dockerfiles/platform-build-incremental/Dockerfile

@@ -28,6 +28,7 @@ RUN apt-get install -y \
 
 RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.17.0/bin/linux/amd64/kubectl && chmod +x ./kubectl && mv ./kubectl /usr/local/bin
 
+USER hpcc
 WORKDIR /hpcc-dev/HPCC-Platform
 
 # NB: PATCH_MD5 ensures cache miss (and therefore rebuild) if MD5 is different
@@ -36,4 +37,7 @@ COPY hpcc.gitpatch .
 RUN if [ -s hpcc.gitpatch ]; then git apply --whitespace=nowarn hpcc.gitpatch; fi
 
 WORKDIR /hpcc-dev/build
+RUN make -j$(($(nproc)*3/2))
+
+USER root
 RUN make -j$(($(nproc)*3/2)) install

+ 20 - 1
dockerfiles/platform-build/Dockerfile

@@ -20,8 +20,19 @@
 ARG BASE_VER=7.8
 FROM hpccsystems/platform-build-base:${BASE_VER}
 
+RUN groupadd -g 1000 hpcc
+RUN useradd -s /bin/bash -r -m -N -c "hpcc runtime User" -u 999 -g hpcc hpcc
+RUN passwd -l hpcc 
+
+
 WORKDIR /hpcc-dev
+RUN chown hpcc:hpcc /hpcc-dev
+
+# Runs as hpcc to fetch sources and build, to aid debugging containers as user hpcc
+USER hpcc
+
 ARG BUILD_USER=hpcc-systems
+RUN echo BUILD_USER is ${BUILD_USER}
 RUN git clone https://github.com/${BUILD_USER}/HPCC-Platform.git && \
     cd HPCC-Platform && \
     git submodule update --init --recursive
@@ -42,6 +53,14 @@ RUN cmake /hpcc-dev/HPCC-Platform -Wno-dev -DCONTAINERIZED=1 -DCMAKE_BUILD_TYPE=
 RUN make -j$(nproc) jlib
 RUN make -j$(nproc) esp
 RUN make -j$(nproc) roxie
-RUN make  ws_workunits  ecl
+RUN make -j$(nproc) ws_workunits ecl
 RUN make -j$(nproc)
+
+USER root
+
 RUN make -j$(nproc) install
+RUN mkdir /var/lib/HPCCSystems && chown hpcc:hpcc /var/lib/HPCCSystems
+RUN mkdir /var/log/HPCCSystems && chown hpcc:hpcc /var/log/HPCCSystems
+RUN mkdir /var/lock/HPCCSystems && chown hpcc:hpcc /var/lock/HPCCSystems
+RUN mkdir /var/run/HPCCSystems && chown hpcc:hpcc /var/run/HPCCSystems
+

+ 2 - 11
dockerfiles/platform-core-debug/Dockerfile

@@ -20,20 +20,11 @@
 ARG BUILD_LABEL
 FROM hpccsystems/platform-build:${BUILD_LABEL}
 
-RUN groupadd -g 1000 hpcc
-RUN useradd -s /bin/bash -r -N -c "hpcc runtime User" -u 999 -g hpcc hpcc
-RUN passwd -l hpcc 
-
-RUN mkdir /var/lib/HPCCSystems && chown hpcc:hpcc /var/lib/HPCCSystems
-RUN mkdir /var/log/HPCCSystems && chown hpcc:hpcc /var/log/HPCCSystems
-RUN mkdir /var/lock/HPCCSystems && chown hpcc:hpcc /var/lock/HPCCSystems
-RUN mkdir /var/run/HPCCSystems && chown hpcc:hpcc /var/run/HPCCSystems
-
 RUN apt-get install -y libcap2-bin
 RUN setcap cap_sys_ptrace+eip /usr/bin/gdb
 
-USER hpcc
-
 ENV PATH="/opt/HPCCSystems/bin:${PATH}"
 ENV HPCC_containerized=1
 ENV HPCC_DLLSERVER_PATH=/var/lib/HPCCSystems/queries
+
+USER hpcc

+ 3 - 0
dockerfiles/platform-core/Dockerfile

@@ -59,6 +59,9 @@ RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.17.0/b
 
 COPY --from=build /opt/HPCCSystems /opt/HPCCSystems
 
+# NB: added in platform-build, but need to re-add as this image is not
+# based on it. Only /opt/HPCCSystems is copied over.
+
 RUN groupadd -g 1000 hpcc
 RUN useradd -s /bin/bash -r -N -c "hpcc runtime User" -u 999 -g hpcc hpcc
 RUN passwd -l hpcc