-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
62 lines (51 loc) · 1.95 KB
/
Dockerfile
File metadata and controls
62 lines (51 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
FROM ubuntu:22.04
# Constants
ARG VERSION_RUST="1.86.0"
ARG VERSION_SC_META="0.59.0"
ARG VERSION_WASM_OPT="0.116.1"
ARG TARGETPLATFORM
# Install system dependencies
RUN apt-get update --fix-missing && apt-get install -y \
wget \
build-essential \
git \
python3.11 python-is-python3 python3-pip \
pkg-config \
libssl-dev
# Install Python dependencies
RUN pip3 install toml==0.10.2 semver==3.0.0-dev.4
# Install rust
RUN wget -O rustup.sh https://sh.rustup.rs && \
chmod +x rustup.sh && \
CARGO_HOME=/rust RUSTUP_HOME=/rust ./rustup.sh --verbose --default-toolchain ${VERSION_RUST} --profile minimal -y && \
rm rustup.sh && \
chmod -R 777 /rust && \
rm -rf /rust/registry
# Install sc-meta tool
RUN PATH="/rust/bin:${PATH}" CARGO_HOME=/rust RUSTUP_HOME=/rust cargo install multiversx-sc-meta --version ${VERSION_SC_META} --locked && \
rm -rf /rust/registry
# Install wasm32 target
RUN PATH="/rust/bin:${PATH}" CARGO_HOME=/rust RUSTUP_HOME=/rust sc-meta install wasm32
# Install wasm-opt
RUN PATH="/rust/bin:${PATH}" CARGO_HOME=/rust RUSTUP_HOME=/rust cargo install wasm-opt --version ${VERSION_WASM_OPT} --locked && \
rm -rf /rust/registry
COPY "multiversx_sdk_rust_contract_builder" "/multiversx_sdk_rust_contract_builder"
ENV PATH="/rust/bin:${PATH}"
ENV CARGO_HOME="/rust"
ENV RUSTUP_HOME="/rust"
ENV PYTHONPATH=/
ENV BUILD_METADATA_VERSION_RUST=${VERSION_RUST}
ENV BUILD_METADATA_VERSION_SC_META=${VERSION_SC_META}
ENV BUILD_METADATA_VERSION_WASM_OPT=${VERSION_WASM_OPT}
ENV BUILD_METADATA_TARGETPLATFORM=${TARGETPLATFORM}
# Additional arguments (must be provided at "docker run"):
# --project or --packaged-src
# --no-wasm-opt (optional)
# --build-root (optional)
ENTRYPOINT ["python", "/multiversx_sdk_rust_contract_builder/main.py", \
"--output", "/output", \
"--cargo-target-dir", "/rust/cargo-target-dir"]
LABEL frozen="yes"
LABEL rust=${VERSION_RUST}
LABEL sc_meta=${VERSION_SC_META}
LABEL wasm_opt=${VERSION_WASM_OPT}