-
Notifications
You must be signed in to change notification settings - Fork 19
/
Dockerfile
70 lines (56 loc) · 2.57 KB
/
Dockerfile
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
63
64
65
66
67
68
69
70
FROM docker.io/library/ubuntu:22.04
LABEL maintainer "[email protected]"
LABEL description="This image contains tools for Substrate blockchains runtimes."
ARG RUSTC_VERSION="1.81.0"
ENV RUSTC_VERSION=$RUSTC_VERSION
ENV DOCKER_IMAGE="paritytech/srtool"
ENV PROFILE=release
ENV PACKAGE=polkadot-runtime
ENV BUILDER=builder
ARG UID=1001
ARG GID=1001
ENV SRTOOL_TEMPLATES=/srtool/templates
RUN groupadd -g $GID $BUILDER && \
useradd --no-log-init -m -u $UID -s /bin/bash -d /home/$BUILDER -r -g $BUILDER $BUILDER
RUN mkdir -p ${SRTOOL_TEMPLATES} && \
mkdir /build && chown -R $BUILDER /build && \
mkdir /out && chown -R $BUILDER /out
WORKDIR /tmp
ENV DEBIAN_FRONTEND=noninteractive
# Tooling
ARG SUBWASM_VERSION=0.21.0
ARG TERA_CLI_VERSION=0.2.4
ARG TOML_CLI_VERSION=0.2.4
COPY ./templates ${SRTOOL_TEMPLATES}/
RUN apt update && \
apt upgrade -y && \
apt install --no-install-recommends -y \
cmake pkg-config libssl-dev make protobuf-compiler \
git clang bsdmainutils ca-certificates curl && \
curl -L https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 --output /usr/bin/jq && chmod a+x /usr/bin/jq && \
rm -rf /var/lib/apt/lists/* /tmp/* && apt clean
RUN curl -L https://github.com/chevdor/subwasm/releases/download/v${SUBWASM_VERSION}/subwasm_linux_amd64_v${SUBWASM_VERSION}.deb --output subwasm.deb && dpkg -i subwasm.deb && subwasm --version && \
curl -L https://github.com/chevdor/tera-cli/releases/download/v${TERA_CLI_VERSION}/tera-cli_linux_amd64.deb --output tera_cli.deb && dpkg -i tera_cli.deb && tera --version && \
curl -L https://github.com/chevdor/toml-cli/releases/download/v${TOML_CLI_VERSION}/toml_linux_amd64_v${TOML_CLI_VERSION}.deb --output toml.deb && dpkg -i toml.deb && toml --version && \
rm -rf /tmp/*
COPY ./scripts/* /srtool/
COPY VERSION /srtool/
COPY RUSTC_VERSION /srtool/
USER $BUILDER
ENV RUSTUP_HOME="/home/${BUILDER}/rustup"
ENV CARGO_HOME="/home/${BUILDER}/cargo"
ENV PATH="/srtool:$PATH"
RUN echo $SHELL && \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
. $CARGO_HOME/env && \
rustup toolchain add stable ${RUSTC_VERSION} && \
rustup target add wasm32-unknown-unknown --toolchain $RUSTC_VERSION && \
rustup component add rust-src --toolchain $RUSTC_VERSION && \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME && \
rustup show && rustc -V
RUN git config --global --add safe.directory /build && \
/srtool/version && \
echo 'PATH=".:$HOME/cargo/bin:$PATH"' >> $HOME/.bashrc
VOLUME [ "/build", "$CARGO_HOME", "/out" ]
WORKDIR /srtool
CMD ["/srtool/build"]