-
Notifications
You must be signed in to change notification settings - Fork 15
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
140adbb
commit a0b6705
Showing
10 changed files
with
279 additions
and
369 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,43 @@ | ||
local | ||
m = import 'baedeker-library/mixin/spec.libsonnet', | ||
; | ||
|
||
local relay = { | ||
name: 'relay', | ||
bin: 'bin/polkadot', | ||
validatorIdAssignment: 'staking', | ||
spec: {Genesis:{ | ||
chain: 'rococo-local', | ||
modify:: m.genericRelay($), | ||
}}, | ||
nodes: { | ||
[name]: { | ||
bin: $.bin, | ||
wantedKeys: 'relay', | ||
}, | ||
for name in ['alice', 'bob', 'charlie', 'dave', 'eve'] | ||
}, | ||
}; | ||
|
||
local unique = { | ||
name: 'unique', | ||
bin: 'bin/unique', | ||
paraId: 1001, | ||
spec: {Genesis:{ | ||
modify:: m.genericPara($), | ||
}}, | ||
nodes: { | ||
[name]: { | ||
bin: $.bin, | ||
wantedKeys: 'para', | ||
}, | ||
for name in ['alice', 'bob'] | ||
}, | ||
}; | ||
|
||
relay + { | ||
parachains: { | ||
[para.name]: para, | ||
for para in [unique] | ||
}, | ||
} |
This file was deleted.
Oops, something went wrong.
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,49 @@ | ||
# ===== Rust builder ===== | ||
FROM ubuntu:22.04 as rust-builder | ||
LABEL maintainer="Unique.Network" | ||
|
||
ENV CARGO_HOME="/cargo-home" | ||
ENV PATH="/cargo-home/bin:$PATH" | ||
ENV TZ=UTC | ||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y curl cmake pkg-config libssl-dev git clang llvm libudev-dev protobuf-compiler && \ | ||
apt-get clean && \ | ||
rm -r /var/lib/apt/lists/* | ||
|
||
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain none | ||
|
||
ARG RUST_TOOLCHAIN | ||
RUN echo "Using Rust '$RUST_TOOLCHAIN'" && \ | ||
rustup toolchain install $RUST_TOOLCHAIN && \ | ||
rustup target add wasm32-unknown-unknown --toolchain ${RUST_TOOLCHAIN} && \ | ||
rustup default $RUST_TOOLCHAIN && \ | ||
rustup target list --installed && \ | ||
rustup show | ||
|
||
RUN mkdir /unique_parachain | ||
WORKDIR /unique_parachain | ||
|
||
# ===== BUILD POLKADOT ===== | ||
FROM rust-builder as builder-polkadot-bin | ||
|
||
WORKDIR /unique_parachain | ||
|
||
ARG UNIQUE_VERSION | ||
RUN git clone -b "$UNIQUE_VERSION" --depth 1 https://github.com/uniquenetwork/unique-chain.git | ||
|
||
ARG RUNTIME_FEATURES | ||
RUN --mount=type=cache,target=/cargo-home/registry \ | ||
--mount=type=cache,target=/cargo-home/git \ | ||
--mount=type=cache,target=/unique_parachain/polkadot/target \ | ||
cd unique-chain && \ | ||
CARGO_INCREMENTAL=0 cargo build --release --features="$RUNTIME_FEATURES" --locked && \ | ||
mv ./target/release/unique-collator /unique_parachain/unique-chain/ | ||
|
||
# ===== BIN ====== | ||
|
||
FROM ubuntu:22.04 as builder-polkadot | ||
|
||
COPY --from=builder-polkadot-bin /unique_parachain/unique-chain/unique-collator /bin/unique-collator | ||
ENTRYPOINT ["/bin/unique-collator"] |
This file was deleted.
Oops, something went wrong.
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,59 @@ | ||
name: Build or pull container | ||
description: '' | ||
inputs: | ||
container: | ||
description: Which name to fetch/push | ||
required: true | ||
tag: | ||
description: Which tag to fetch/push | ||
required: true | ||
context: | ||
description: Container context | ||
required: true | ||
default: "." | ||
dockerfile: | ||
description: Path to dockerfile (relative to context) | ||
required: true | ||
args: | ||
description: Docker build extra args | ||
default: '' | ||
dockerhub_username: | ||
description: Secret | ||
dockerhub_token: | ||
description: Secret | ||
outputs: | ||
name: | ||
description: Full container name | ||
value: ${{ steps.ensure.outputs.name }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Ensure have ${{ inputs.container }}:${{ inputs.tag }} | ||
id: ensure | ||
run: | | ||
echo "Wanted container: ${{ inputs.container }}:${{ inputs.tag }}" | ||
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${{ inputs.dockerhub_username }}'", "password": "'${{ inputs.dockerhub_token }}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token) | ||
# Get TAGS from DOCKERHUB | ||
TAGS=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/${{ inputs.container }}/tags/?page_size=100 | jq -r '."results"[]["name"]' || echo "") | ||
echo "Available tags:" | ||
echo "$TAGS" | ||
# Check correct version POLKADOT and build it if it doesn't exist in POLKADOT TAGS | ||
if [[ ${TAGS[*]} =~ (^|[[:space:]])"${{ inputs.tag }}"($|[[:space:]]) ]]; then | ||
echo "Repository has needed version, pulling"; | ||
docker pull ${{ inputs.container }}:${{ inputs.tag }} | ||
else | ||
echo "Repository had no needed version, so build it"; | ||
cd "${{ inputs.context }}" && docker build --file "${{ inputs.dockerfile }}" \ | ||
$BUILD_ARGS --tag ${{ inputs.container }}:${{ inputs.tag }} \ | ||
. | ||
echo "Push built version to the repository"; | ||
docker push ${{ inputs.container }}:${{ inputs.tag }} || true | ||
fi | ||
echo "name=${{ inputs.container }}:${{ inputs.tag }}" >> $GITHUB_OUTPUT | ||
env: | ||
BUILD_ARGS: ${{ inputs.args }} | ||
shell: bash |
Oops, something went wrong.