|
| 1 | +# Copyright (C) 2025 Siemens |
| 2 | +# |
| 3 | +# SPDX-License-Identifier: MIT |
| 4 | + |
| 5 | +ARG DEBIAN_TAG=trixie-slim |
| 6 | + |
| 7 | +FROM debian:${DEBIAN_TAG} AS debsbom |
| 8 | + |
| 9 | +ARG SOURCE_DATE_EPOCH |
| 10 | + |
| 11 | +ARG DEBIAN_TAG=trixie-slim |
| 12 | + |
| 13 | +ARG TARGETPLATFORM |
| 14 | +ARG DEBIAN_FRONTEND=noninteractive |
| 15 | +ENV LANG=en_US.utf8 |
| 16 | +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ |
| 17 | + --mount=type=cache,target=/var/lib/apt,sharing=locked \ |
| 18 | + rm -f /etc/apt/apt.conf.d/docker-clean && \ |
| 19 | + echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-packages.conf && \ |
| 20 | + if echo "${DEBIAN_TAG}" | grep -q "[0-9]"; then \ |
| 21 | + sed -i -e '/^URIs:/d' -e 's|^# http://snapshot\.|URIs: http://snapshot.|' \ |
| 22 | + /etc/apt/sources.list.d/debian.sources; \ |
| 23 | + echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/use-snapshot.conf; \ |
| 24 | + echo 'Acquire::Retries "10";' >> /etc/apt/apt.conf.d/use-snapshot.conf; \ |
| 25 | + echo 'Acquire::Retries::Delay::Maximum "600";' >> /etc/apt/apt.conf.d/use-snapshot.conf; \ |
| 26 | + fi && \ |
| 27 | + apt-get update && \ |
| 28 | + apt-get install -y locales && \ |
| 29 | + localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 && \ |
| 30 | + apt-get install --no-install-recommends -y \ |
| 31 | + python3-apt python3-cyclonedx-lib python3-debian python3-packageurl \ |
| 32 | + python3-beartype python3-click python3-license-expression python3-ply \ |
| 33 | + python3-rdflib python3-semantic-version python3-uritools python3-xmltodict \ |
| 34 | + python3-yaml && \ |
| 35 | + rm -rf /var/log/* /tmp/* /var/tmp/* /var/cache/ldconfig/aux-cache |
| 36 | + |
| 37 | +# install debsbom in a reproducible way |
| 38 | +RUN --mount=type=bind,target=/debsbom,rw \ |
| 39 | + apt-get update && \ |
| 40 | + apt-get install --no-install-recommends -y \ |
| 41 | + python3-pip python3-setuptools && \ |
| 42 | + pip3 --proxy=$https_proxy install \ |
| 43 | + --no-deps \ |
| 44 | + --no-build-isolation \ |
| 45 | + --break-system-packages \ |
| 46 | + --root-user-action=ignore \ |
| 47 | + spdx-tools==0.8.3 \ |
| 48 | + /debsbom && \ |
| 49 | + rm -rf $(pip3 cache dir) && \ |
| 50 | + apt-get autopurge -y python3-pip python3-setuptools && \ |
| 51 | + rm -rf /var/log/* /tmp/* /var/tmp/* /var/cache/ldconfig/aux-cache && \ |
| 52 | + debsbom --version |
0 commit comments