@@ -3,18 +3,64 @@ FROM alpine:3.17 as builder
3
3
4
4
WORKDIR /workdir
5
5
6
+ ARG RUST_PYTHON_VERSION="0.2.0"
7
+ ENV CARGO_HOME="/workdir"
8
+ ENV CARGO_INSTALL_ROOT="/workdir"
9
+
6
10
# Newer rust needed due to let...else feature
7
11
RUN apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community rust cargo
8
12
9
13
RUN apk --no-cache add musl-dev
10
14
11
- RUN cargo install --root /workdir --git https://github.com/RustPython/RustPython --tag v0.2.0 --features freeze-stdlib --profile release
15
+ ADD https://github.com/RustPython/RustPython/archive/refs/tags/v$RUST_PYTHON_VERSION.tar.gz /tmp/v$RUST_PYTHON_VERSION.tar.gz
16
+
17
+ RUN tar --strip-components=1 -C /workdir -xzf /tmp/v$RUST_PYTHON_VERSION.tar.gz
18
+
19
+ RUN cargo fetch --locked
20
+
21
+ RUN cargo build --features freeze-stdlib --release --locked --offline --bin rustpython
12
22
13
23
FROM alpine:3.17
14
24
15
25
RUN apk --no-cache add musl libgcc
16
26
17
- COPY --from=builder /workdir/bin/rustpython /usr/local/bin/rustpython
27
+ COPY --from=builder /workdir/target/release/rustpython /usr/local/bin/rustpython
28
+ COPY <<-EOT /usr/local/share/sbom/rustpython.spdx.json
29
+ {
30
+ "spdxVersion" : "SPDX-2.3" ,
31
+ "dataLicense" : "CC0-1.0" ,
32
+ "SPDXID" : "SPDXRef-DOCUMENT" ,
33
+ "name" : "docker-rustpython" ,
34
+ "packages" : [
35
+ {
36
+ "name" : "rustpython" ,
37
+ "SPDXID" : "SPDXRef-Package-binary-rustpython-${RUST_PYTHON_VERSION}" ,
38
+ "versionInfo" : "${RUST_PYTHON_VERSION}" ,
39
+ "downloadLocation" : "https://github.com/RustPython/RustPython" ,
40
+ "sourceInfo" : "Built from source at: https://github.com/RustPython/RustPython" ,
41
+ "licenseConcluded" : "MIT" ,
42
+ "licenseDeclared" : "MIT" ,
43
+ "copyrightText" : "NOASSERTION" ,
44
+ "description" : "rustpython"
45
+ }
46
+ ],
47
+ "files" : [
48
+ {
49
+ "SPDXID" : "SPDXRef-rustpython-${RUST_PYTHON_VERSION}" ,
50
+ "licenseConcluded" : "MIT" ,
51
+ "fileName" : "/usr/local/bin/rustpython" ,
52
+ "fileType" : "BINARY"
53
+ }
54
+ ],
55
+ "relationships" : [
56
+ {
57
+ "spdxElementId" : "SPDXRef-Package-binary-rustpython-${RUST_PYTHON_VERSION}" ,
58
+ "relationshipType" : "CONTAINS" ,
59
+ "relatedSpdxElement" : "SPDXRef-rustpython-${RUST_PYTHON_VERSION}"
60
+ }
61
+ ]
62
+ }
63
+ EOT
18
64
19
65
RUN rustpython --version && \
20
66
echo -e "import json\n print(json.dumps([{'server': [{'tls': False}]}]))" | rustpython -q
0 commit comments