Skip to content

Commit

Permalink
fix(reporter): Add ScanCode license texts to reporter docker image
Browse files Browse the repository at this point in the history
Dump the ScanCode license texts to directory
/opt/scancode-license-data
when creating the reporter docker container.
This directory is used by ORT as fallback option if the
ScanCode license texts cannot be located by
the existing heuristic look-up algorithm.

See oss-review-toolkit/ort#9622.

Signed-off-by: Wolfgang Klenk <wolfgang.klenk2@bosch.com>
  • Loading branch information
wkl3nk committed Dec 20, 2024
1 parent 37fbb3a commit 99e6636
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions workers/reporter/docker/Reporter.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,24 @@ RUN chgrp -R 0 /home/ort && chmod -R g+rwX /home/ort
USER $USERNAME
WORKDIR $HOMEDIR

COPY --from=scancode-license-data-build --chown=$USER:$USER /opt/scancode-license-data /opt/scancode-license-data

ENTRYPOINT ["/bin/bash"]

# Build-Stage for Python executing scancode-license-data to get the license texts in a directory
FROM python:3.11-slim AS scancode-license-data-build

# Keep in sync with Scanner.Dockerfile
ARG SCANCODE_VERSION=32.2.1

RUN apt-get update && apt-get install -y curl libgomp1 && rm -rf /var/lib/apt/lists/*

# Use pip to install ScanCode
RUN curl -Os https://raw.githubusercontent.com/nexB/scancode-toolkit/v$SCANCODE_VERSION/requirements.txt && \
pip install -U --constraint requirements.txt scancode-toolkit==$SCANCODE_VERSION && \
rm requirements.txt

# Extract ScanCode license data to directory.
RUN scancode-license-data --path /opt/scancode-license-data \
&& find /opt/scancode-license-data -type f -not -name "*.LICENSE" -exec rm -f {} + \
&& rm -rf /opt/scancode-license-data/static

0 comments on commit 99e6636

Please sign in to comment.