-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f649c37
commit 2f74d1e
Showing
2 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.github | ||
.vscode | ||
scripts | ||
target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
FROM ubuntu:jammy AS builder | ||
|
||
# The node will be built in this directory | ||
WORKDIR /infra-did-substrate | ||
|
||
RUN apt -y update && \ | ||
apt install -y --no-install-recommends \ | ||
software-properties-common llvm curl git file binutils binutils-dev \ | ||
make cmake ca-certificates clang g++ zip dpkg-dev openssl gettext \ | ||
build-essential pkg-config libssl-dev libudev-dev time clang protobuf-compiler | ||
|
||
# install rustup | ||
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y | ||
|
||
# rustup directory | ||
ENV PATH /root/.cargo/bin:$PATH | ||
|
||
# setup rust nightly channel, pinning specific version as newer versions have a regression | ||
RUN rustup install nightly | ||
|
||
RUN rustup install stable | ||
|
||
# install wasm toolchain for substrate | ||
RUN rustup target add wasm32-unknown-unknown --toolchain nightly | ||
|
||
#compiler ENV | ||
ENV CC clang | ||
ENV CXX g++ | ||
|
||
# Copy code to build directory, instead of only using .dockerignore, we copy elements | ||
# explicitly. This lets us cache build results while iterating on scripts. | ||
COPY . . | ||
|
||
# Pass the features while building image as `--build-arg features='--features mainnet'` or `--build-arg features='--features testnet'` | ||
ARG features | ||
ARG release | ||
|
||
RUN if [ "$release" = "Y" ] ; then \ | ||
echo 'Building in release mode.' ; \ | ||
WASM_BUILD_TOOLCHAIN=nightly cargo build --profile=release $features ; \ | ||
mv /infra-did-substrate/target/release/infradid /infra-did-substrate/target/; \ | ||
else \ | ||
echo 'Building in production mode.' ; \ | ||
WASM_BUILD_TOOLCHAIN=nightly cargo build --profile=production $features ; \ | ||
mv /infra-did-substrate/target/production/infradid /infra-did-substrate/target/; \ | ||
fi | ||
|
||
# Final stage. Copy the node executable and the script | ||
FROM ubuntu:jammy | ||
|
||
WORKDIR /infra-did-substrate | ||
|
||
COPY --from=builder /infra-did-substrate/target/infradid . | ||
|
||
# curl is required for uploading to keystore | ||
# note: `subkey insert` is a potential alternarve to curl | ||
RUN apt -y update \ | ||
&& apt install -y --no-install-recommends curl \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# expose node ports | ||
EXPOSE 30333 9933 9944 | ||
|
||
ENV RUST_BACKTRACE 1 | ||
|
||
ENTRYPOINT ["./infradid"] | ||
CMD [] |