1
- # Use Ubuntu
2
- FROM ubuntu:latest
1
+ # OSI Dockerfile
2
+ # Setup OSI environment and setup API service
3
+ #
4
+ # @author Derek Garcia
5
+
6
+ # Install tooling
7
+ FROM alpine/curl AS spdx_sbom_generator
8
+ ENV SPDX_SBOM_GENERATOR=https://github.com/opensbom-generator/spdx-sbom-generator/releases/download/v0.0.15/spdx-sbom-generator-v0.0.15-linux-amd64.tar.gz
9
+ RUN curl -L $SPDX_SBOM_GENERATOR -o /tmp/spdx-sbom-generator.tar.gz && tar -C /tmp -xzf /tmp/spdx-sbom-generator.tar.gz
10
+
11
+ FROM alpine/curl AS jbom
12
+ ENV JBOM=https://github.com/eclipse/jbom/releases/download/v1.2.1/jbom-1.2.1.jar
13
+ RUN curl -L $JBOM -o tmp/jbom.jar
14
+
15
+ FROM alpine/curl AS cyclone_dx_cli
16
+ ENV CYCLONEDX_CLI=https://github.com/CycloneDX/cyclonedx-cli/releases/latest/download/cyclonedx-linux-x64
17
+ RUN curl -L $CYCLONEDX_CLI -o tmp/cyclonedx-cli
18
+ # apt install -y libicu-dev
19
+
20
+ FROM alpine/curl AS syft
21
+ RUN curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /tmp
22
+
23
+ FROM alpine/curl AS sbomtool
24
+ RUN curl -L https://github.com/microsoft/sbom-tool/releases/latest/download/sbom-tool-linux-x64 -o tmp/sbom-tool
25
+
26
+ FROM alpine/curl AS osi
3
27
4
28
# PHP Setup
5
29
ENV DEBIAN_FRONTEND=noninteractive
6
30
ENV DEBCONF_NONINTERACTIVE_SEEN=true
7
31
ENV COMPOSER_ALLOW_SUPERUSER=1
8
32
9
33
# Go Setup
10
- ENV PATH=$PATH:/usr/local/go/bin:/root/go/bin
34
+ ENV PATH=$PATH:/usr/local/go/bin
35
+
36
+ # Rust setup
37
+ ENV PATH=$PATH:/root/.cargo/bin
11
38
12
39
# Dotnet tools
13
40
ENV PATH=$PATH:/root/.dotnet/tools
14
41
15
- # Node.js Setup
16
- ENV NVM_DIR=/root/.nvm
17
-
18
42
# Bound Directories
19
43
ENV CODE_IN=/bound_dir/code
20
44
ENV SBOM_OUT=/bound_dir/sboms
21
45
22
- # Copy startup scripts
23
- COPY scripts/ /usr/local/bin/
24
- # Copy Flask webserver scripts
25
- COPY server/ /server
46
+ #
47
+ # Setup the OSI enviroment
48
+ #
26
49
27
- # Run setup script
28
- RUN /bin/bash -c setup.sh
50
+ # Install languages
51
+ RUN apk update && apk add \
52
+ python3 \
53
+ openjdk21-jdk \
54
+ dotnet6-sdk \
55
+ nodejs
56
+ # go
57
+ COPY --from=golang:alpine /usr/local/go/ /usr/local/go/
58
+ # rust
59
+ RUN apk add \
60
+ build-base \
61
+ libffi-dev \
62
+ openssl-dev
63
+ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
29
64
30
- # Cleanup
31
- RUN rm /usr/local/bin/setup.sh
65
+ # Install Package managers
66
+ RUN apk add \
67
+ py3-pip \
68
+ maven \
69
+ gradle \
70
+ composer \
71
+ npm
72
+ # conan
73
+ RUN pip install --break-system-packages conan
74
+
75
+ # Install tools using package managers
76
+ RUN pip install --break-system-packages flask jake cyclonedx-conan cyclonedx-bom scanoss sbom4python sbom4rust sbom4files
77
+ RUN npm install -g retire bower cdx-bower-bom @cyclonedx/cdxgen@8.6.0
78
+ RUN go install github.com/ozonru/cyclonedx-go/cmd/cyclonedx-go@latest
79
+ RUN go install github.com/mattermost/gobom/cmd/gobom@latest
80
+ RUN dotnet tool install --global covenant
81
+ RUN cargo install -- cargo-cyclonedx
82
+ RUN composer global config --no-plugins allow-plugins.cyclonedx/cyclonedx-php-composer true
83
+ RUN composer \
84
+ --ignore-platform-req=ext-xmlwriter \
85
+ --ignore-platform-req=ext-dom \
86
+ global require cyclonedx/cyclonedx-php-composer
87
+
88
+ # Copy binaries
89
+ COPY --from=spdx_sbom_generator --chmod=755 /tmp/spdx-sbom-generator /usr/local/bin/
90
+ COPY --from=jbom --chmod=755 tmp/jbom.jar /usr/local/bin/
91
+ COPY --from=cyclone_dx_cli --chmod=755 tmp/cyclonedx-cli /usr/local/bin/
92
+ COPY --from=syft --chmod=755 tmp/syft /usr/local/bin/
93
+ COPY --from=sbomtool --chmod=755 tmp/sbom-tool /usr/local/bin/
32
94
33
- RUN ["chmod" , "+x" , "/usr/local/bin/runner.sh" ]
95
+ # Verify installation
96
+ COPY --chmod=755 scripts/ /usr/local/bin/
97
+ RUN . validate.sh
98
+
99
+ # Setup flask api server
100
+ WORKDIR /server
101
+ COPY server/ .
102
+ RUN pip install --break-system-packages -r requirements.txt
103
+
104
+ # Cleanup
105
+ RUN rm -rf /var/cache/apk/* /tmp/*
34
106
35
- ENTRYPOINT ["usr/local/bin/ runner.sh" ]
107
+ CMD ["runner.sh" ]
0 commit comments