Skip to content

Commit 0110cd0

Browse files
cdromasdcyrille18
authored andcommitted
fix: add corepack to docker image to properly manage NodeJS packages managers
1 parent 1c41085 commit 0110cd0

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ 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/
@@ -28,10 +29,7 @@ RUN apk update
2829
apk add --no-cache git ruby ruby-rdoc npm && \
2930
gem install bundler-audit && \
3031
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 && \
32+
npm install -g corepack && \
3533
unzip dependency-check-${VERSION}-release.zip -d /usr/share/ && \
3634
rm dependency-check-${VERSION}-release.zip && \
3735
cd /usr/share/dependency-check/plugins && \
@@ -50,6 +48,11 @@ RUN apk update
5048
RUN find / -path /proc -prune -perm +6000 -type f -exec chmod a-s {} \;
5149
USER ${UID}
5250

51+
### preload pnpm and yarn
52+
RUN corepack enable && \
53+
corepack prepare pnpm@latest --activate && \
54+
corepack prepare yarn@1.22.22 --activate
55+
5356
VOLUME ["/src", "/report"]
5457

5558
WORKDIR /src

0 commit comments

Comments
 (0)