Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion docker-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ createPersistentDockerDataVolume()
# shellcheck disable=SC2154
echo "Removing old volumes and containers"
# shellcheck disable=SC2046
${BUILD_CONFIG[DOCKER]} rm -f $(${BUILD_CONFIG[DOCKER]} ps -a --no-trunc -q -f volume="${BUILD_CONFIG[DOCKER_SOURCE_VOLUME_NAME]}") || true
local old_containers=$(${BUILD_CONFIG[DOCKER]} ps -a --no-trunc -q -f volume="${BUILD_CONFIG[DOCKER_SOURCE_VOLUME_NAME]}")
if [[ ${old_containers} != "" ]]; then
${BUILD_CONFIG[DOCKER]} rm -f $(old_containers) || true
else
echo "No old container was found"
fi
${BUILD_CONFIG[DOCKER]} volume rm -f "${BUILD_CONFIG[DOCKER_SOURCE_VOLUME_NAME]}" || true

# shellcheck disable=SC2154
Expand Down
2 changes: 1 addition & 1 deletion docker/dockerfile-generator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ printUserCreate(){
echo "
ARG HostUID
ENV HostUID=\$HostUID
RUN useradd -u \$HostUID -ms /bin/bash build
RUN useradd -o -u \$HostUID -ms /bin/bash build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's a good idea to allow for non-unique IDs here. In particular, allowing UID=0 to be non-unique. The fix is to not build with as root.

WORKDIR /openjdk/build
RUN chown -R build /openjdk/
USER build" >> "$DOCKERFILE_PATH"
Expand Down