forked from paritytech/substrate
-
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
Showing
5 changed files
with
120 additions
and
7 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,8 @@ | ||
[workspace] | ||
members = [ | ||
"node", | ||
"pallets/template", | ||
"runtime", | ||
] | ||
[profile.release] | ||
panic = "unwind" |
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
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,4 +1,4 @@ | ||
version: "3.2" | ||
services: | ||
|
||
services: | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
args=$@ | ||
cargo build --release | ||
|
||
# we do not need to use `useradd` to create another non-root user since we are | ||
# using a pre-built image that has already created one called 'nonroot': | ||
# see https://hub.docker.com/r/paritytech/ci-linux/tags > "production" > Layer 12 | ||
usermod -u 1000 -s /bin/sh -d /var/www/node-template nonroot | ||
mkdir -p /data /var/www/node-template/.local/share/node-template | ||
# change owner to non-root user of static symlink directory for storing chain data | ||
chown -R nonroot:nonroot /data | ||
# change owner to non-root user for hidden subdirectories of their home directory | ||
chown -R nonroot:nonroot /var/www/node-template/.[^.]* | ||
# change owner to non-root user for non-hidden subdirectories of their home directory | ||
chown -R nonroot:nonroot /var/www/node-template | ||
|
||
# ignore warning: `Not copying any file from skel directory into it.` | ||
symlink=/var/www/node-template/.local/share/node-template/data | ||
# create symlink if not already exist | ||
[ ! -L ${symlink} ] && ln -s /data /var/www/node-template/.local/share/node-template | ||
# copy skel files to user nonroot home directory if it already exists | ||
cp -r /etc/skel/. /var/www/node-template | ||
# sanity checks | ||
ldd -d -r -v /var/www/node-template/target/release/node-template | ||
|
||
# switch to non-root user. show version of node-template. | ||
su -c "printf \"\n*** Changed to the home directory ${PWD} of user: \" && id \ | ||
&& /var/www/node-template/target/release/node-template --version" nonroot | ||
|
||
# handle when arguments not provided. run arguments provided to script. | ||
if [ "$args" = "" ] ; then | ||
su -c "printf \"Note: Please try providing an argument to the script.\n\n\"" nonroot | ||
exit 1 | ||
else | ||
su -c "printf \"*** Running the provided arguments: $args\n\n\"" nonroot | ||
su -c "$args" nonroot | ||
fi |
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