Skip to content

Commit ba5d778

Browse files
authored
Merge pull request #525 from cloudfoundry/fix_bundle_config_jammy
[Jammy] Fix "bundle install" permission error in os-image-stemcell-builder Docker image
2 parents b5c9df8 + 242992d commit ba5d778

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

ci/docker/os-image-stemcell-builder/Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ RUN meta4_cli_path="/usr/local/bin/meta4" \
9696
> "${meta4_cli_path}" \
9797
&& chmod +x "${meta4_cli_path}"
9898

99+
ENV GEM_HOME="${GEM_HOME}" \
100+
BUNDLE_APP_CONFIG="${GEM_HOME}" \
101+
BUNDLE_SILENCE_ROOT_WARNING=1
102+
ENV PATH="${GEM_HOME}/bin:${PATH}"
103+
99104
RUN cd /tmp \
100105
&& curl --show-error -sL "${RUBY_INSTALL_URL}" \
101106
| tar -xzf - \
@@ -108,9 +113,8 @@ RUN cd /tmp \
108113
&& ruby-install --jobs=${NUM_CPUS} --cleanup --system ruby ${RUBY_VERSION} \
109114
-- --disable-install-doc --disable-install-rdoc \
110115
&& gem update --system \
111-
&& bundle config --global path "${GEM_HOME}" \
112-
&& bundle config --global bin "${GEM_HOME}/bin"
113-
ENV PATH=${GEM_HOME}/bin:${PATH}
116+
&& mkdir -p "${GEM_HOME}/bin" \
117+
&& chown -R ubuntu:ubuntu "${GEM_HOME}"
114118

115119
RUN syft_cli_path="/usr/local/bin/syft" \
116120
&& curl --show-error -sL "${SYFT_CLI_URL}" \

ci/tasks/os-images/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fi
3333
sudo chown -R ubuntu .
3434
sudo chown -R ubuntu:ubuntu /mnt
3535
sudo chmod u+s "$(which sudo)"
36-
sudo --preserve-env --set-home --user ubuntu -- /bin/bash --login -i <<SUDO
3736
bundle install --local
37+
sudo --preserve-env --set-home --user ubuntu -- /bin/bash --login -i <<SUDO
3838
bundle exec rake stemcell:build_os_image[$OPERATING_SYSTEM_NAME,$OPERATING_SYSTEM_VERSION,$OS_IMAGE]
3939
SUDO

0 commit comments

Comments
 (0)