forked from NearSocial/social-db
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_docker.sh
More file actions
executable file
·29 lines (22 loc) · 871 Bytes
/
build_docker.sh
File metadata and controls
executable file
·29 lines (22 loc) · 871 Bytes
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
#!/usr/bin/env bash
# Exit script as soon as a command fails.
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
NAME="build_social_db"
if docker ps -a --format '{{.Names}}' | grep -Eq "^${NAME}\$"; then
echo "Container exists"
else
docker create \
--mount type=bind,source=$DIR,target=/host \
--cap-add=SYS_PTRACE --security-opt seccomp=unconfined \
--name=$NAME \
-w /host \
-e RUSTFLAGS='-C link-arg=-s' \
-it \
nearprotocol/contract-builder \
/bin/bash
fi
docker start $NAME
docker exec -it $NAME /bin/bash -c "rustup toolchain install 1.69.0; rustup default 1.69.0; rustup target add wasm32-unknown-unknown; cargo build --package contract --target wasm32-unknown-unknown --release"
mkdir -p res
cp $DIR/target/wasm32-unknown-unknown/release/contract.wasm $DIR/res/social_db_release.wasm