-
Notifications
You must be signed in to change notification settings - Fork 1
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
d99cb63
commit 27087ae
Showing
2 changed files
with
26 additions
and
13 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 |
---|---|---|
@@ -1,10 +1,15 @@ | ||
# This is an example build stage for the node template. Here we create the binary in a temporary image. | ||
|
||
# This is a base image to build substrate nodes | ||
FROM ubuntu:22.04 as builder | ||
FROM ubuntu:22.04 AS builder | ||
|
||
ARG PROFILE=production | ||
|
||
ARG SUBSTRATE_CLI_GIT_COMMIT_HASH | ||
|
||
# Incremental compilation here isn't helpful | ||
ENV CARGO_INCREMENTAL=0 | ||
|
||
WORKDIR /subcoin | ||
|
||
RUN \ | ||
|
@@ -18,26 +23,34 @@ RUN \ | |
clang \ | ||
cmake \ | ||
make && \ | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
|
||
RUN /root/.cargo/bin/rustup target add wasm32-unknown-unknown | ||
# RUN /root/.cargo/bin/rustup target add wasm32-unknown-unknown | ||
|
||
COPY . . | ||
|
||
RUN cargo build --locked --profile=production | ||
# This resolves the warning: [email protected]: Could not find `.git/HEAD` searching from `/subcoin/crates/subcoin-node` upwards! | ||
|
||
# Copy only necessary git information | ||
# COPY .git/HEAD .git/HEAD | ||
# COPY .git/refs .git/refs | ||
|
||
RUN /root/.cargo/bin/cargo build --locked --profile=$PROFILE | ||
|
||
# This is the 2nd stage: a very small image where we copy the binary." | ||
FROM docker.io/library/ubuntu:22.04 | ||
LABEL description="Multistage Docker image for Substrate Node Template" \ | ||
LABEL description="Multistage Docker image for Subcoin Node" \ | ||
image.type="builder" \ | ||
image.authors="[email protected]" \ | ||
image.vendor="Substrate Developer Hub" \ | ||
image.description="Multistage Docker image for Substrate Node Template" \ | ||
image.source="https://github.com/substrate-developer-hub/substrate-subcoin" \ | ||
image.documentation="https://github.com/substrate-developer-hub/substrate-subcoin" | ||
image.authors="[email protected]" \ | ||
image.vendor="Subcoin Contributors" \ | ||
image.description="Multistage Docker image for Subnode Node" \ | ||
image.source="https://github.com/subcoin-project/subcoin" \ | ||
image.documentation="https://subcoin-project.github.io/subcoin" | ||
|
||
ARG PROFILE=production | ||
|
||
# Copy the node binary. | ||
COPY --from=builder /subcoin/target/production/subcoin /usr/local/bin | ||
COPY --from=builder /subcoin/target/$PROFILE/subcoin /usr/local/bin | ||
|
||
RUN useradd -m -u 1000 -U -s /bin/sh -d /node-dev node-dev && \ | ||
mkdir -p /chain-data /node-dev/.local/share && \ | ||
|
@@ -46,7 +59,7 @@ RUN useradd -m -u 1000 -U -s /bin/sh -d /node-dev node-dev && \ | |
# unclutter and minimize the attack surface | ||
rm -rf /usr/bin /usr/sbin && \ | ||
# check if executable works in this container | ||
/usr/local/bin/subcoin --version | ||
/usr/local/bin/subcoin --help | ||
|
||
USER node-dev | ||
|
||
|
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