|
1 | | -# Use an official Python runtime as a parent image |
2 | | -FROM python:3.10-slim |
3 | | - |
4 | | -# Set environment variables for versions with default values |
5 | | -ARG POETRY_VERSION=1.8.0 |
6 | | -ARG NODE_VERSION=18 |
7 | | -ARG CYCLONE_PYTHON_VERSION=4.5.0 |
8 | | -ARG CYCLONE_NPM_VERSION=1.19.3 |
9 | | - |
10 | | -# Install system dependencies and tools |
11 | | -RUN apt-get update && \ |
12 | | - apt-get install -y \ |
13 | | - curl \ |
14 | | - gnupg \ |
15 | | - jq \ |
16 | | - && rm -rf /var/lib/apt/lists/* |
17 | | - |
18 | | -# Install Node.js |
19 | | -RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - && \ |
20 | | - apt-get install -y nodejs |
21 | | - |
22 | | -# Install cyclonedx |
23 | | -RUN pip install cyclonedx-bom==${CYCLONE_PYTHON_VERSION} |
24 | | -RUN npm install -g @cyclonedx/cyclonedx-npm@${CYCLONEDX_VERSION} |
| 1 | +FROM mcr.microsoft.com/devcontainers/base:ubuntu-24.04 |
| 2 | + |
| 3 | +RUN apt-get update \ |
| 4 | + && export DEBIAN_FRONTEND=noninteractive \ |
| 5 | + && apt-get -y dist-upgrade \ |
| 6 | + && apt-get -y install --no-install-recommends htop vim curl git build-essential \ |
| 7 | + libffi-dev libssl-dev libxml2-dev libxslt1-dev libjpeg8-dev libbz2-dev \ |
| 8 | + zlib1g-dev unixodbc unixodbc-dev libsecret-1-0 libsecret-1-dev libsqlite3-dev \ |
| 9 | + jq apt-transport-https ca-certificates gnupg-agent \ |
| 10 | + software-properties-common bash-completion python3-pip make libbz2-dev \ |
| 11 | + libreadline-dev libsqlite3-dev wget llvm libncurses5-dev libncursesw5-dev \ |
| 12 | + xz-utils tk-dev liblzma-dev libyaml-dev bats bats-support bats-assert bats-file \ |
| 13 | + python3 python3-pip python3-dev |
| 14 | + |
| 15 | +# Install ASDF |
| 16 | +RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.1; \ |
| 17 | + echo '. /root/.asdf/asdf.sh' >> ~/.bashrc; \ |
| 18 | + echo '. /root/.asdf/completions/asdf.bash' >> ~/.bashrc; \ |
| 19 | + echo 'PATH="$PATH:/root/.asdf/bin/"' >> ~/.bashrc; |
| 20 | + |
| 21 | +ENV PATH="$PATH:/root/.asdf/bin/" |
| 22 | + |
| 23 | +# Install ASDF plugins |
| 24 | +RUN asdf plugin add shellcheck https://github.com/luizm/asdf-shellcheck.git; \ |
| 25 | + asdf plugin add actionlint; \ |
| 26 | + asdf plugin add python; \ |
| 27 | + asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git; \ |
| 28 | + asdf plugin add poetry https://github.com/asdf-community/asdf-poetry.git; |
25 | 29 |
|
26 | 30 | # Install Grype |
27 | 31 | RUN curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin |
28 | 32 |
|
29 | | -WORKDIR /github/workspace |
| 33 | +# For each supported npm version, asdf install, and install cyclonedx (latest versions) |
| 34 | + |
| 35 | +ADD node18/.tool-versions /node_versions/node18/.tool-versions |
| 36 | +WORKDIR /node_versions/node18 |
| 37 | +RUN asdf install |
| 38 | +RUN asdf exec npm install -g @cyclonedx/cyclonedx-npm |
| 39 | +RUN asdf exec python -m pip install cyclonedx-bom |
| 40 | + |
| 41 | + |
| 42 | +ADD node20/.tool-versions /node_versions/node20/.tool-versions |
| 43 | +WORKDIR /node_versions/node20 |
| 44 | +RUN asdf install |
| 45 | +RUN asdf exec npm install -g @cyclonedx/cyclonedx-npm |
| 46 | +RUN asdf exec python -m pip install --no-cache-dir cyclonedx-bom |
| 47 | + |
| 48 | + |
| 49 | +ADD node22/.tool-versions /node_versions/node22/.tool-versions |
| 50 | +WORKDIR /node_versions/node22 |
| 51 | +RUN asdf install |
| 52 | +RUN asdf exec npm install -g @cyclonedx/cyclonedx-npm |
| 53 | +RUN asdf exec python -m pip install --no-cache-dir cyclonedx-bom |
| 54 | + |
| 55 | + |
| 56 | +# Set the workdir to what we'll actually use |
| 57 | +WORKDIR /working |
| 58 | + |
| 59 | +# And install cyclonedx in this asdf environment |
| 60 | +RUN echo "python 3.12.5" >> .tool-versions |
| 61 | +RUN asdf exec python -m pip install --no-cache-dir cyclonedx-bom |
| 62 | +RUN rm .tool-versions |
| 63 | + |
| 64 | +# Files to execute when the docker container starts up |
| 65 | +ADD entrypoint.sh /entrypoint.sh |
| 66 | +ADD check-sbom-issues-against-ignores.sh /check-sbom-issues-against-ignores.sh |
30 | 67 |
|
31 | | -COPY entrypoint.sh /entrypoint.sh |
32 | | -COPY check-sbom-issues-against-ignores.sh /check-sbom-issues-against-ignores.sh |
| 68 | +# Set the umask so that the files created by docker can be universally accessed. |
| 69 | +# Lets the tests successfully teardown. |
| 70 | +RUN echo "umask 000" >> /etc/profile |
33 | 71 |
|
34 | | -# Code file to execute when the docker container starts up |
35 | 72 | ENTRYPOINT ["/entrypoint.sh"] |
0 commit comments