Skip to content

Commit 0d194fe

Browse files
dcyrille18cdromaschadlwilson
authored
fix: add corepack to docker image (#8386)
Signed-off-by: Chad Wilson <29788154+chadlwilson@users.noreply.github.com> Co-authored-by: Cyrille Dromas <cyrille.dromas@renault.com> Co-authored-by: Chad Wilson <29788154+chadlwilson@users.noreply.github.com>
1 parent 7816ddf commit 0d194fe

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

Dockerfile

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,18 @@ ENV user=dependencycheck
1717
ENV JAVA_HOME=/opt/jdk
1818
ENV JAVA_OPTS="-Danalyzer.assembly.dotnet.path=/usr/bin/dotnet -Danalyzer.bundle.audit.path=/usr/bin/bundle-audit -Danalyzer.golang.path=/usr/local/go/bin/go"
1919
ENV ODC_NAME=dependency-check-docker
20+
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=false
2021

2122
COPY --from=jlink /jlinked /opt/jdk/
2223
COPY --from=go /usr/local/go/ /usr/local/go/
2324

2425
ADD cli/target/dependency-check-${VERSION}-release.zip /
2526

26-
RUN apk update && \
27-
apk add --no-cache --virtual .build-deps curl tar && \
28-
apk add --no-cache git ruby ruby-rdoc npm && \
29-
gem install bundler-audit && \
30-
bundle audit update && \
31-
mkdir /opt/yarn && \
32-
curl -Ls https://yarnpkg.com/latest.tar.gz | tar -xz --strip-components=1 --directory /opt/yarn && \
33-
ln -s /opt/yarn/bin/yarn /usr/bin/yarn && \
34-
npm install -g pnpm && \
27+
RUN apk upgrade --no-cache && \
28+
apk add --no-cache --virtual .build-deps curl && \
29+
apk add --no-cache git ruby npm && \
30+
gem install --no-document bundler-audit && \
31+
npm install --global --ignore-scripts corepack && \
3532
unzip dependency-check-${VERSION}-release.zip -d /usr/share/ && \
3633
rm dependency-check-${VERSION}-release.zip && \
3734
cd /usr/share/dependency-check/plugins && \
@@ -44,12 +41,19 @@ RUN apk update
4441
mkdir /report && \
4542
chown -R ${user}:0 /report && \
4643
chmod -R g=u /report && \
47-
apk del .build-deps
44+
apk del .build-deps && \
45+
rm -rf /tmp/* /root/.cache /root/.npm
4846

4947
### remove any suid sgid - we don't need them
5048
RUN find / -path /proc -prune -perm +6000 -type f -exec chmod a-s {} \;
5149
USER ${UID}
5250

51+
### Cache pieces needed for the specific run user
52+
RUN bundle audit update && \
53+
corepack prepare pnpm@latest yarn@latest yarn@1 --activate && \
54+
printf "enableTelemetry: false\nenableScripts: false\n" >> ${HOME}/.yarnrc.yml && \
55+
rm -rf /tmp/*
56+
5357
VOLUME ["/src", "/report"]
5458

5559
WORKDIR /src

0 commit comments

Comments
 (0)