Skip to content
Merged
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
10 changes: 7 additions & 3 deletions docker-image/Dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ RUN curl -kL https://services.gradle.org/distributions/gradle-9.2.1-bin.zip -o /
RUN curl -kL https://go.dev/dl/go1.25.5.linux-amd64.tar.gz -o /tmp/golang-package.tar.gz \
&& tar xvzf /tmp/golang-package.tar.gz -C /usr/

# install corepack and package managers (pnpm, yarn) - stage to /usr/local for easy copying
# install corepack and package managers (pnpm, yarn classic + berry) - stage to /usr/local for easy copying
ENV COREPACK_HOME=/usr/local/corepack/cache
RUN npm install -g corepack@latest \
&& corepack enable \
&& corepack prepare pnpm@10.1.0 --activate \
&& corepack prepare yarn@1.22.22 \
&& corepack prepare yarn@4.9.1 --activate \
&& NPM_PREFIX=$(npm config get prefix) \
&& mkdir -p /usr/local/corepack/bin \
Expand Down Expand Up @@ -111,12 +112,15 @@ ENV GRADLE_HOME=/usr/gradle-9.2.1
COPY --from=builder /usr/local/corepack/ /usr/local/corepack/
ENV COREPACK_HOME=/usr/local/corepack/cache

# Install Python via microdnf and fix corepack cache permissions
# Install Python via microdnf, create yarn wrapper scripts, and fix permissions
USER root
RUN microdnf install -y python3 python3-pip \
&& microdnf clean all \
&& chown -R 1001:0 /usr/local/corepack/cache \
&& chmod -R g+rwX /usr/local/corepack/cache
&& chmod -R g+rwX /usr/local/corepack/cache \
&& printf '#!/bin/sh\nexec corepack yarn@1.22.22 "$@"\n' > /usr/local/bin/yarn-classic \
&& printf '#!/bin/sh\nexec corepack yarn@4.9.1 "$@"\n' > /usr/local/bin/yarn-berry \
&& chmod +x /usr/local/bin/yarn-classic /usr/local/bin/yarn-berry
USER 1001

# Update PATH (corepack bin first for pnpm/yarn to be found reliably)
Expand Down
5 changes: 3 additions & 2 deletions docker-image/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ Ecosystem | Version
Maven | 3.9.12 |
Gradle | 9.2.1 |
Go | 1.25.5 |
NPM | 10.8.2 |
NPM | 11.6.2 |
PNPM | 10.1.0 |
Yarn | 4.9.1 |
Yarn Classic | 4.9.1 |
Yarn Berry | 1.22.22 |
Python | 3.9.25 |

## Usage Notes
Expand Down
27 changes: 26 additions & 1 deletion docker-image/scripts/trustify-da.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,31 @@ output_file_path="$2"

printf "Analyzing the stack. Please wait..\n\n"

# Get the directory containing the manifest file
manifest_dir=$(dirname "$manifest_file_path")
manifest_name=$(basename "$manifest_file_path")

# Detect and set the correct yarn version if this is a yarn project
if [ "$manifest_name" = "package.json" ] && [ -f "$manifest_dir/yarn.lock" ]; then
# Check if packageManager is already declared in package.json
package_manager=$(jq -r '.packageManager // empty' "$manifest_file_path" 2>/dev/null)

if [ -z "$package_manager" ]; then
# No packageManager declared, detect based on project files
if [ -f "$manifest_dir/.yarnrc.yml" ]; then
# .yarnrc.yml exists = Yarn Berry
printf "Detected Yarn Berry project (found .yarnrc.yml), using yarn@4.9.1\n"
export TRUSTIFY_DA_YARN_PATH=/usr/local/bin/yarn-berry
else
# No .yarnrc.yml = Yarn Classic
Comment thread
ruromero marked this conversation as resolved.
printf "Detected Yarn Classic project, using yarn@1.22.22\n"
export TRUSTIFY_DA_YARN_PATH=/usr/local/bin/yarn-classic
fi
else
printf "Using declared packageManager: %s\n" "$package_manager"
fi
fi

# Getting RHDA stack analysis report using Exhort Javascript CLI.
report=$(trustify-da-javascript-client stack $manifest_file_path 2>error.log)

Expand Down Expand Up @@ -90,5 +115,5 @@ printf "=%.0s" {1..50}
$output_file_path

printf "\nFull report is saved into file: $output_file_path"
printf "\nTask is completed."
printf "\nTask is completed.\n"
fi
Loading